using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using ICP_MS.Plugin.Advance.Properties;
using ZedGraph;

namespace ICP_MS.Plugin.Advance;

public class FormQuad : Form
{
	private bool isQuit = false;

	private bool isTune = false;

	private bool bClearPoints = false;

	private AutoResetEvent scanEvent = new AutoResetEvent(initialState: false);

	private bool bCali = false;

	private IContainer components = null;

	private Button btnQPok;

	private GroupBox gQuadParamemter;

	private NumericUpDown nudDCB0;

	private NumericUpDown nudDCK0;

	private NumericUpDown nudACB0;

	private System.Windows.Forms.Label label27;

	private NumericUpDown nudACK0;

	private System.Windows.Forms.Label label26;

	private System.Windows.Forms.Label label14;

	private System.Windows.Forms.Label label25;

	private GroupBox gbQuadScanP;

	private GroupBox gbQuadMonitor;

	private Button btnMatch;

	private Button btn48VOff;

	private System.Windows.Forms.Label label8;

	private Button btn48VOn;

	private System.Windows.Forms.Label label7;

	private NumericUpDown nudFreq;

	private System.Windows.Forms.Label label6;

	private TextBox txtHV;

	private System.Windows.Forms.Label label5;

	private TextBox txtDC;

	private System.Windows.Forms.Label label4;

	private TextBox txtRF;

	private System.Windows.Forms.Label label3;

	private TextBox txtLV;

	private System.Windows.Forms.Label label2;

	private TextBox txtPHeat;

	private System.Windows.Forms.Label lblPower;

	private TextBox txtT;

	private System.Windows.Forms.Label lblTempertature;

	private GroupBox gbCurve;

	private ZedGraphControl graph;

	private Button btnCurve;

	private GroupBox gbQuadStatus;

	private PictureBox pbStatusErI;

	private System.Windows.Forms.Label label18;

	private PictureBox pbStatusTune;

	private System.Windows.Forms.Label label17;

	private PictureBox pbStatusRelay;

	private System.Windows.Forms.Label label16;

	private PictureBox pbStatus48V;

	private System.Windows.Forms.Label label15;

	private PictureBox pbStatusBias;

	private System.Windows.Forms.Label label11;

	private PictureBox pbStatusRF;

	private System.Windows.Forms.Label label10;

	private PictureBox pbStatusMod;

	private System.Windows.Forms.Label label13;

	private PictureBox pbStatusDCNeg;

	private System.Windows.Forms.Label label12;

	private PictureBox pbStatusDcPlus;

	private System.Windows.Forms.Label label9;

	private NumericUpDown nudTemperature;

	private System.Windows.Forms.Label label1;

	private TextBox txtFreq;

	private System.Windows.Forms.Label label20;

	private TextBox txt48V;

	private System.Windows.Forms.Label label19;

	private NumericUpDown nudTune;

	private Button btnTemperature;

	private Button btnFreq;

	private ZedGraphControl graph2;

	private TabControl tabControl1;

	private TabPage pageQuad;

	private TabPage pageQuadMonitor;

	private GroupBox groupBox1;

	private ListBox listInfo;

	private Button btnTuneSecond;

	private Button btnTuneFirst;

	private Button btnStop;

	private Button button1;

	private System.Windows.Forms.Label label21;

	private NumericUpDown nudHexK0;

	private System.Windows.Forms.Label label22;

	private NumericUpDown nudHexB0;

	private Button button2;

	private Button button3;

	private NumericUpDown numericUpDown1;

	private ZedGraphControl zedGraphControl1;

	private Button button4;

	private System.Windows.Forms.Label label23;

	private ZedGraphControl graphRFDC;

	private Button button5;

	private ZedGraphControl graphTP;

	private CheckBox checkBox4;

	private CheckBox checkBox3;

	private CheckBox checkBox2;

	private CheckBox checkBox1;

	private TableLayoutPanel tableLayoutPanel1;

	public FormQuad()
	{
		InitializeComponent();
	}

	private void btnQPok_Click(object sender, EventArgs e)
	{
		RFManager.massQP.rfk0 = decimal.ToDouble(nudACK0.Value);
		RFManager.massQP.rfb0 = decimal.ToDouble(nudACB0.Value);
		RFManager.massQP.dck0 = decimal.ToDouble(nudDCK0.Value);
		RFManager.massQP.dcb0 = decimal.ToDouble(nudDCB0.Value);
	}

	private void FormQuad_Load(object sender, EventArgs e)
	{
		base.WindowState = FormWindowState.Maximized;
		ApplyResources();
		zedGraphControl1.GraphPane.Title.Text = "";
		zedGraphControl1.GraphPane.XAxis.Title.Text = Lang.Txt("AddFormQuad.Freq");
		zedGraphControl1.GraphPane.YAxis.Title.Text = Lang.Txt("AddFormQuad.RF");
		GraphPane pane = graph.GraphPane;
		pane.Title.Text = "T && P";
		pane.XAxis.Title.Text = "Time";
		pane.YAxis.Title.Text = "T/℃";
		pane.Y2Axis.Title.Text = "P/W";
		pane.Y2Axis.IsVisible = true;
		pane.YAxis.MajorGrid.IsVisible = true;
		pane.XAxis.MajorGrid.IsVisible = true;
		GraphPane pane2 = graph2.GraphPane;
		pane2.Title.Text = "RF && DC";
		pane2.XAxis.Title.Text = "Time";
		pane2.YAxis.Title.Text = "RF/V";
		pane2.Y2Axis.Title.Text = "DC/V";
		pane2.Y2Axis.IsVisible = true;
		pane2.YAxis.MajorGrid.IsVisible = true;
		pane2.XAxis.MajorGrid.IsVisible = true;
		GraphPane paneTP = graphTP.GraphPane;
		paneTP.Title.Text = "T && P";
		paneTP.XAxis.Title.Text = "Time";
		paneTP.XAxis.Type = AxisType.Date;
		paneTP.XAxis.Scale.Format = "HH:mm:ss";
		paneTP.YAxis.Title.Text = "T/℃";
		paneTP.Y2Axis.Title.Text = "P/W";
		paneTP.Y2Axis.IsVisible = true;
		paneTP.YAxis.MajorGrid.IsVisible = true;
		paneTP.XAxis.MajorGrid.IsVisible = true;
		paneTP.AddCurve(Lang.Txt("AddFormQuad.Temp"), new PointPairList(), Color.Red, SymbolType.None);
		paneTP.AddCurve(Lang.Txt("AddFormQuad.Power"), new PointPairList(), Color.Blue, SymbolType.None);
		GraphPane paneRFDC = graphRFDC.GraphPane;
		paneRFDC.Title.Text = "RF && DC";
		paneRFDC.XAxis.Title.Text = "Time";
		paneRFDC.XAxis.Type = AxisType.Date;
		paneRFDC.XAxis.Scale.Format = "HH:mm:ss";
		paneRFDC.YAxis.Title.Text = "RF/V";
		paneRFDC.Y2Axis.Title.Text = "DC/V";
		paneRFDC.Y2Axis.IsVisible = true;
		paneRFDC.YAxis.MajorGrid.IsVisible = true;
		paneRFDC.XAxis.MajorGrid.IsVisible = true;
		paneRFDC.AddCurve("RF", new PointPairList(), Color.Red, SymbolType.None);
		paneRFDC.AddCurve("DC", new PointPairList(), Color.Blue, SymbolType.None);
		UserManager.UserChanged += UserManager_UserChanged;
		PermissionManagement();
		try
		{
			nudACK0.Value = Convert.ToDecimal(RFManager.massQP.rfk0);
			nudACB0.Value = Convert.ToDecimal(RFManager.massQP.rfb0);
			nudDCK0.Value = Convert.ToDecimal(RFManager.massQP.dck0);
			nudDCB0.Value = Convert.ToDecimal(RFManager.massQP.dcb0);
			nudFreq.Value = Convert.ToDecimal(QuadMonitor.quad.Freq);
			nudTemperature.Value = Convert.ToDecimal(QuadMonitor.quad.Temperature);
		}
		catch (Exception)
		{
		}
		Task.Factory.StartNew(UpdateQuadStatus);
		Task.Factory.StartNew(UpdateCurve);
		Detector.finishReceive += Scan_massFinishReceive;
	}

	private void UpdateCurve()
	{
		while (!base.IsDisposed)
		{
			if (bClearPoints)
			{
				graphRFDC.GraphPane.CurveList[0].Clear();
				graphRFDC.GraphPane.CurveList[1].Clear();
				graphTP.GraphPane.CurveList[0].Clear();
				graphTP.GraphPane.CurveList[1].Clear();
				bClearPoints = false;
			}
			graphRFDC.GraphPane.CurveList[0].AddPoint(new XDate(DateTime.Now), QuadMonitor.quad.ReadRF);
			graphRFDC.GraphPane.CurveList[1].AddPoint(new XDate(DateTime.Now), QuadMonitor.quad.ReadDC);
			graphTP.GraphPane.CurveList[0].AddPoint(new XDate(DateTime.Now), QuadMonitor.quad.ReadT);
			graphTP.GraphPane.CurveList[1].AddPoint(new XDate(DateTime.Now), QuadMonitor.quad.ReadPheat);
			Invoke((MethodInvoker)delegate
			{
				graphRFDC.AxisChange();
				graphTP.AxisChange();
				graphRFDC.Refresh();
				graphTP.Refresh();
			});
			Thread.Sleep(1000);
		}
	}

	private void Scan_massFinishReceive(object sender, EventArgs e)
	{
		scanEvent.Set();
	}

	private void ApplyResources()
	{
		Text = Lang.Txt("FormQuad.Title.Text");
		gbQuadStatus.Text = Lang.Txt("FormQuad.GroupBox.Status.Text");
		label11.Text = Lang.Txt("FormQuad.PreBias.Text");
		gbQuadMonitor.Text = Lang.Txt("FormQuad.GroupBox.Monitor.Text");
		lblTempertature.Text = Lang.Txt("FormQuad.Monitor.Temperature.Text");
		lblPower.Text = Lang.Txt("FormQuad.Monitor.HeatingPower.Text");
		label19.Text = Lang.Txt("FormQuad.Monitor.Current48.Text");
		label20.Text = Lang.Txt("FormQuad.Monitor.WorkingFreq.Text");
		gQuadParamemter.Text = Lang.Txt("FormQuad.GroupBox.Param.Text");
		label6.Text = Lang.Txt("FormQuad.Param.WorkingFreq.Text");
		label1.Text = Lang.Txt("FormQuad.Param.WorkingTemperature.Text");
		label7.Text = Lang.Txt("FormQuad.Param.Relays48.Text");
		label8.Text = Lang.Txt("FormQuad.Param.MatchingTunning.Text");
		gbQuadScanP.Text = Lang.Txt("FormQuad.GroupBox.Param.Text");
		btnQPok.Text = Lang.Txt("FormQuad.Button.Set.Text");
		btnCurve.Text = Lang.Txt("FormQuad.Button.Refresh.Text");
		btnFreq.Text = Lang.Txt("FormQuad.Button.Set.Text");
		btnTemperature.Text = Lang.Txt("FormQuad.Button.Set.Text");
		btn48VOn.Text = Lang.Txt("FormQuad.Button.Open.Text");
		btn48VOff.Text = Lang.Txt("FormQuad.Button.Close.Text");
		btnMatch.Text = Lang.Txt("FormQuad.Button.Tune.Text");
		gbCurve.Text = Lang.Txt("FormQuad.GroupBox.TemperatureAndHeatingPower.Text");
		pageQuad.Text = Lang.Txt("ADD.Quad.QuadInform.Text");
		pageQuadMonitor.Text = Lang.Txt("ADD.Quad.TempPower.Text");
		label23.Text = Lang.Txt("ADD.Quad.QuadInform.SettingVoltage");
		button3.Text = Lang.Txt("FormQuad.Button.Set.Text");
		groupBox1.Text = Lang.Txt("ADD.Quad.QuadInform.AutoTune");
		listInfo.Items[0] = Lang.Txt("ADD.Quad.QuadInform.AutoTuneProgress");
		button4.Text = Lang.Txt("ADD.Quad.QuadInform.InitialTune");
		btnTuneSecond.Text = Lang.Txt("ADD.Quad.QuadInform.Finetuned");
		btnStop.Text = Lang.Txt("ADD.Quad.QuadInform.Stop");
		button1.Text = Lang.Txt("ADD.Quad.QuadInform.Correction");
		button2.Text = Lang.Txt("ADD.Quad.QuadInform.Cancel");
		button5.Text = Lang.Txt("ADD.Quad.TempPower.Refresh");
		checkBox1.Text = Lang.Txt("ADD.Quad.TempPower.Temp");
		checkBox2.Text = Lang.Txt("ADD.Quad.TempPower.Power");
		checkBox3.Text = Lang.Txt("ADD.Quad.TempPower.RFVoltage");
		checkBox4.Text = Lang.Txt("ADD.Quad.TempPower.DCVoltage");
	}

	private void UserManager_UserChanged(object sender, EventArgs e)
	{
		PermissionManagement();
	}

	private void FormQuad_FormClosing(object sender, FormClosingEventArgs e)
	{
		isQuit = true;
		isTune = false;
		UserManager.UserChanged -= UserManager_UserChanged;
		Detector.finishReceive -= Scan_massFinishReceive;
	}

	private bool BitStatus(int status, int idx)
	{
		return ((status >> idx) & 1) == 1;
	}

	private void SetUnconnected()
	{
		Invoke((MethodInvoker)delegate
		{
			foreach (object current in gbQuadStatus.Controls)
			{
				if (current is PictureBox pictureBox)
				{
					pictureBox.Image = Resources.led_Gray;
				}
			}
			foreach (object current2 in gbQuadMonitor.Controls)
			{
				if (current2 is TextBox textBox)
				{
					textBox.Text = "--";
				}
			}
		});
	}

	private void UpdateQuadStatus()
	{
		Quad quad = QuadMonitor.quad;
		while (!isQuit)
		{
			if (quad.StatusConnected)
			{
				Invoke((MethodInvoker)delegate
				{
					txtT.Text = quad.ReadT.ToString("F2");
					txtPHeat.Text = quad.ReadPheat.ToString("F2");
					txtLV.Text = quad.ReadLV.ToString("F2");
					txtRF.Text = quad.ReadRF.ToString("F2");
					txtDC.Text = quad.ReadDC.ToString("F2");
					txtHV.Text = quad.ReadHV.ToString("F2");
					txt48V.Text = quad.ReadI48.ToString("F2");
					txtFreq.Text = quad.ReadFreq.ToString();
					pbStatusDcPlus.Image = (BitStatus(quad.ReadState, 0) ? Resources.led_Red : Resources.led_Green);
					pbStatusDCNeg.Image = (BitStatus(quad.ReadState, 1) ? Resources.led_Red : Resources.led_Green);
					pbStatusRF.Image = (BitStatus(quad.ReadState, 2) ? Resources.led_Red : Resources.led_Green);
					pbStatusMod.Image = (BitStatus(quad.ReadState, 3) ? Resources.led_Red : Resources.led_Green);
					pbStatusBias.Image = (BitStatus(quad.ReadState, 4) ? Resources.led_Red : Resources.led_Green);
					pbStatus48V.Image = (BitStatus(quad.ReadState, 5) ? Resources.led_Red : Resources.led_Green);
					pbStatusRelay.Image = ((!BitStatus(quad.ReadState, 6)) ? Resources.led_Red : Resources.led_Green);
					pbStatusTune.Image = (BitStatus(quad.ReadState, 7) ? Resources.led_Red : Resources.led_Green);
					pbStatusErI.Image = (BitStatus(quad.ReadState, 8) ? Resources.led_Red : Resources.led_Green);
				});
			}
			else
			{
				SetUnconnected();
			}
			Thread.Sleep(5000);
		}
	}

	private void btnCurve_Click(object sender, EventArgs e)
	{
		GraphPane pane = graph.GraphPane;
		pane.CurveList.Clear();
		double[] dataT = QuadMonitor.Instance.TDatas;
		double[] dataP = QuadMonitor.Instance.PheatDatas;
		if (dataT != null && dataT.Length != 0 && dataP != null && dataP.Length != 0)
		{
			double[] t1 = new double[dataT.Length];
			double[] d1 = new double[dataT.Length];
			for (int l = 0; l < t1.Length; l++)
			{
				t1[l] = l * 4;
				d1[l] = dataT[l];
			}
			double[] t2 = new double[dataP.Length];
			double[] d2 = new double[dataP.Length];
			for (int k = 0; k < t2.Length; k++)
			{
				t2[k] = k * 4;
				d2[k] = dataP[k];
			}
			LineItem line1 = pane.AddCurve("T", t1, d1, Color.Red, SymbolType.None);
			LineItem line2 = pane.AddCurve("P", t2, d2, Color.Blue, SymbolType.None);
			line2.IsY2Axis = true;
			pane.AxisChange();
			graph.Refresh();
		}
		GraphPane pane2 = graph2.GraphPane;
		pane2.CurveList.Clear();
		double[] dataR = QuadMonitor.Instance.RFDatas;
		double[] dataD = QuadMonitor.Instance.DCDatas;
		if (dataR != null && dataR.Length != 0 && dataD != null && dataD.Length != 0)
		{
			double[] t3 = new double[dataR.Length];
			double[] d3 = new double[dataR.Length];
			for (int j = 0; j < t3.Length; j++)
			{
				t3[j] = j * 4;
				d3[j] = dataR[j];
			}
			double[] t4 = new double[dataD.Length];
			double[] d4 = new double[dataD.Length];
			for (int i = 0; i < t4.Length; i++)
			{
				t4[i] = i * 4;
				d4[i] = dataD[i];
			}
			LineItem line3 = pane2.AddCurve("RF", t3, d3, Color.Green, SymbolType.None);
			LineItem line4 = pane2.AddCurve("DC", t4, d4, Color.Black, SymbolType.None);
			line4.IsY2Axis = true;
			pane2.AxisChange();
			graph2.Refresh();
		}
	}

	private void btn48VOn_Click(object sender, EventArgs e)
	{
		QuadMonitor.Instance.On48V();
		Log.InsertLog(Lang.Txt("AddFormIonSource.UserAction"), "On48V", "", (Severity)1);
	}

	private void btn48VOff_Click(object sender, EventArgs e)
	{
		QuadMonitor.Instance.Off48V();
		Log.InsertLog(Lang.Txt("AddFormIonSource.UserAction"), "Off48V", "", (Severity)1);
	}

	private void btnMatch_Click(object sender, EventArgs e)
	{
		int freq = decimal.ToInt32(nudTune.Value);
		QuadMonitor.Instance.TuneMatch(freq);
		Log.InsertLog(Lang.Txt("AddFormIonSource.UserAction"), Lang.Txt("AddFormQuad.QuadrupoleTuning"), "", (Severity)1);
	}

	private void btnFreq_Click(object sender, EventArgs e)
	{
		int value = decimal.ToInt32(nudFreq.Value);
		QuadMonitor.quad.Freq = value;
		QuadMonitor.Instance.SetFreq();
		Log.InsertLog(Lang.Txt("AddFormIonSource.UserAction"), Lang.Txt("AddFormQuad.SetQuadrupoleFrequency"), "", (Severity)1);
	}

	private void btnTemperature_Click(object sender, EventArgs e)
	{
		QuadMonitor.quad.Temperature = decimal.ToInt32(nudTemperature.Value);
		QuadMonitor.Instance.SetTemperature();
		Log.InsertLog(Lang.Txt("AddFormIonSource.UserAction"), Lang.Txt("AddFormQuad.SetQuadrupoleTemp"), "", (Severity)1);
	}

	private void PermissionManagement()
	{
		if (UserManager.CurrentUser.authority <= 1)
		{
			gbQuadMonitor.Visible = true;
			gQuadParamemter.Visible = false;
			gbQuadScanP.Visible = false;
			gbCurve.Visible = true;
			label16.Visible = false;
			pbStatusRelay.Visible = false;
		}
		else
		{
			gbQuadMonitor.Visible = true;
			gQuadParamemter.Visible = true;
			gbQuadScanP.Visible = true;
			gbCurve.Visible = true;
			label16.Visible = true;
			pbStatusRelay.Visible = true;
		}
	}

	private void btnTuneFirst_Click(object sender, EventArgs e)
	{
		isTune = true;
		Task.Factory.StartNew(delegate
		{
			Invoke((MethodInvoker)delegate
			{
				listInfo.Items.Clear();
				listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.StartQuadrupoleTuning"));
			});
			if (MessageBox.Show(Lang.Txt("AddFormQuad.MakeSureQuadrupoleturned"), Lang.Txt("AddFormIonSource.Warn"), MessageBoxButtons.OKCancel) == DialogResult.Cancel)
			{
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.CancelTuning"));
					listInfo.Refresh();
				});
			}
			else
			{
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.DetermineStepValue")));
				});
				QuadMonitor.quad.Freq = QuadMonitor.quad.ReadFreq;
				QuadMonitor.Instance.SetFreq();
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetWorkingFrequency"), QuadMonitor.quad.Freq));
					listInfo.Refresh();
				});
				Thread.Sleep(5000);
				double _RFMax = QuadMonitor.quad.ReadRF;
				int _FreqMax = QuadMonitor.quad.ReadFreq;
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.RFVoltage"), QuadMonitor.quad.ReadRF));
					listInfo.Refresh();
				});
				int delta = 0;
				QuadMonitor.quad.Freq += 1000;
				QuadMonitor.Instance.SetFreq();
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetWorkingFrequency"), QuadMonitor.quad.Freq));
				});
				Thread.Sleep(5000);
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.RFVoltage"), QuadMonitor.quad.ReadRF));
				});
				if (QuadMonitor.quad.ReadRF > _RFMax)
				{
					_RFMax = QuadMonitor.quad.ReadRF;
					_FreqMax = QuadMonitor.quad.Freq;
					delta = 1000;
				}
				else
				{
					QuadMonitor.quad.Freq -= 1000;
					_FreqMax = QuadMonitor.quad.Freq;
					delta = -1000;
				}
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.DetermineStepValue2"), delta));
				});
				while (true)
				{
					if (!isTune)
					{
						return;
					}
					QuadMonitor.quad.Freq += delta;
					QuadMonitor.Instance.SetFreq();
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetWorkingFrequency"), QuadMonitor.quad.Freq));
						listInfo.Refresh();
					});
					Thread.Sleep(5000);
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.RFVoltage"), QuadMonitor.quad.ReadRF));
					});
					if (!(QuadMonitor.quad.ReadRF > _RFMax))
					{
						break;
					}
					_RFMax = QuadMonitor.quad.ReadRF;
					_FreqMax = QuadMonitor.quad.Freq;
					bool flag = true;
				}
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.OptimalWorkingFrequency"), _FreqMax));
				});
				QuadMonitor.quad.Freq = _FreqMax;
				QuadMonitor.Instance.SetFreq();
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.RFVoltage"), _RFMax));
				});
				isTune = false;
			}
		});
	}

	private void TuneSecond()
	{
		bool isError = false;
		Invoke((MethodInvoker)delegate
		{
			listInfo.Items.Clear();
			listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.FineTuning"));
		});
		double _LVMin = 0.0;
		int _FreqMin = 0;
		if (MessageBox.Show(Lang.Txt("AddFormQuad.MakeSureQuadrupoleturnedTop"), Lang.Txt("AddFormIonSource.Warn"), MessageBoxButtons.OKCancel) == DialogResult.Cancel)
		{
			Invoke((MethodInvoker)delegate
			{
				listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.CancelTuning"));
				listInfo.Refresh();
			});
			isTune = false;
			return;
		}
		QuadMonitor.Instance.On48V();
		Thread.Sleep(2000);
		if (!BitStatus(QuadMonitor.quad.ReadState, 6))
		{
			Invoke((MethodInvoker)delegate
			{
				listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.FailedSwitchWorking"));
				listInfo.Refresh();
			});
			isTune = false;
			return;
		}
		int oldfreq = QuadMonitor.quad.ReadFreq;
		int mass = 101;
		Invoke((MethodInvoker)delegate
		{
			listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SuspendValue"), mass));
		});
		int sleeptime = 5000;
		int delta = 500;
		int indelta = 500;
		while (mass < 250)
		{
			if (!isTune || isError)
			{
				return;
			}
			Detector.Instance.msDetectorRF.SetM((double)mass, (double)QuadMonitor.quad.ReadFreq);
			Thread.Sleep(sleeptime);
			Invoke((MethodInvoker)delegate
			{
				listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.LVVoltageValue"), QuadMonitor.quad.ReadLV));
			});
			int trytimes = 0;
			int Freq = QuadMonitor.quad.ReadFreq;
			while (BitStatus(QuadMonitor.quad.ReadState, 2) || BitStatus(QuadMonitor.quad.ReadState, 3))
			{
				if (trytimes >= 3)
				{
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetQuadVoltage"), QuadMonitor.quad.Freq));
					});
					QuadMonitor.quad.Freq = Freq;
					QuadMonitor.Instance.SetFreq();
					Thread.Sleep(sleeptime);
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.FirstAttemptFailed")));
					});
					break;
				}
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.QuadRFPowerError")));
				});
				QuadMonitor.quad.Freq = QuadMonitor.quad.ReadFreq + 1000;
				QuadMonitor.Instance.SetFreq();
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetQuadVoltageTimes"), trytimes + 1, QuadMonitor.quad.Freq));
				});
				Thread.Sleep(sleeptime);
				Detector.Instance.msDetectorRF.SetM((double)mass, (double)QuadMonitor.quad.ReadFreq);
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetSuspendValue"), mass));
				});
				Thread.Sleep(sleeptime);
				trytimes++;
				Thread.Sleep(sleeptime);
				if (!isTune)
				{
					break;
				}
			}
			if (BitStatus(QuadMonitor.quad.ReadState, 2) || BitStatus(QuadMonitor.quad.ReadState, 3))
			{
				mass -= 20;
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.LoweringSuspendValue"), mass));
				});
				Detector.Instance.msDetectorRF.SetM((double)mass, (double)QuadMonitor.quad.ReadFreq);
				Thread.Sleep(sleeptime);
				if (!BitStatus(QuadMonitor.quad.ReadState, 2) && !BitStatus(QuadMonitor.quad.ReadState, 3))
				{
					continue;
				}
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.LoweringSuspendValueFailed"));
				});
				if (MessageBox.Show(Lang.Txt("AddFormQuad.PleaseRestoreNormalTuning"), Lang.Txt("AddFormIonSource.Warn"), MessageBoxButtons.OKCancel) == DialogResult.Cancel)
				{
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.CancelTuning"));
						listInfo.Refresh();
					});
					isTune = false;
					return;
				}
				QuadMonitor.Instance.Off48V();
				Thread.Sleep(1000);
				QuadMonitor.Instance.On48V();
				Thread.Sleep(5000);
				if (!BitStatus(QuadMonitor.quad.ReadState, 2) && !BitStatus(QuadMonitor.quad.ReadState, 3))
				{
					continue;
				}
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.TuningFailed"));
					listInfo.Refresh();
				});
				isTune = false;
				return;
			}
			if (QuadMonitor.quad.ReadLV > 8.0)
			{
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.LVVltage"), QuadMonitor.quad.ReadLV));
				});
				_LVMin = QuadMonitor.quad.ReadLV;
				_FreqMin = QuadMonitor.quad.ReadFreq;
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.LVVoltageValue"), QuadMonitor.quad.ReadLV));
				});
				int step = ((mass > 200) ? 1000 : 1000);
				QuadMonitor.quad.Freq += step;
				QuadMonitor.Instance.SetFreq();
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetQuadFrequency"), QuadMonitor.quad.Freq));
				});
				Thread.Sleep(sleeptime);
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.LVVoltageValue"), QuadMonitor.quad.ReadLV));
				});
				if (QuadMonitor.quad.ReadLV < _LVMin)
				{
					indelta = step;
				}
				else
				{
					indelta = -step;
				}
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.DetermineStepValue2"), indelta));
				});
				QuadMonitor.quad.Freq = _FreqMin;
				while (true)
				{
					if (!isTune || isError)
					{
						return;
					}
					QuadMonitor.quad.Freq += indelta;
					QuadMonitor.Instance.SetFreq();
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetQuadFrequency"), QuadMonitor.quad.Freq));
					});
					Thread.Sleep(sleeptime);
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.LVVoltageValue"), QuadMonitor.quad.ReadLV));
					});
					Detector.Instance.msDetectorRF.SetM((double)mass, (double)QuadMonitor.quad.ReadFreq);
					Thread.Sleep(sleeptime);
					if (!(QuadMonitor.quad.ReadLV < _LVMin))
					{
						break;
					}
					_LVMin = QuadMonitor.quad.ReadLV;
					_FreqMin = QuadMonitor.quad.Freq;
					bool flag = true;
				}
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.OptimalWorkingFrequency"), _FreqMin));
				});
				QuadMonitor.quad.Freq = _FreqMin;
				QuadMonitor.Instance.SetFreq();
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.LVVoltageValue"), _LVMin));
				});
				QuadMonitor.quad.Freq = _FreqMin;
				QuadMonitor.Instance.SetFreq();
				Thread.Sleep(sleeptime);
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetQuadFrequency"), QuadMonitor.quad.Freq));
				});
			}
			if (QuadMonitor.quad.ReadLV > 12.0)
			{
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.DriveLVReachedMax"), (mass > 230) ? (mass - 1) : (mass - 5)));
					listInfo.Refresh();
				});
				isTune = false;
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetSuspendValue"), mass));
				});
				Detector.Instance.msDetectorRF.SetM(101.0, (double)QuadMonitor.quad.ReadFreq);
				return;
			}
			if (mass < 230)
			{
				mass += 5;
				sleeptime = 5000;
			}
			else
			{
				mass++;
				sleeptime = 10000;
			}
			Detector.Instance.msDetectorRF.SetSuspend(false);
			Invoke((MethodInvoker)delegate
			{
				listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SuspendValueIs"), mass));
			});
		}
		isTune = false;
		Invoke((MethodInvoker)delegate
		{
			listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetSuspendValue"), 101));
		});
		Detector.Instance.msDetectorRF.SetM(101.0, (double)QuadMonitor.quad.ReadFreq);
	}

	private void TuneSecondForOld()
	{
		bool isError = false;
		Invoke((MethodInvoker)delegate
		{
			listInfo.Items.Clear();
			listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.FineTuning"));
		});
		double _LVMin = 0.0;
		int _FreqMin = 0;
		if (MessageBox.Show(Lang.Txt("AddFormQuad.MakeSureQuadrupoleturnedTop"), Lang.Txt("AddFormIonSource.Warn"), MessageBoxButtons.OKCancel) == DialogResult.Cancel)
		{
			Invoke((MethodInvoker)delegate
			{
				listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.CancelTuning"));
				listInfo.Refresh();
			});
			isTune = false;
			return;
		}
		QuadMonitor.Instance.On48V();
		Thread.Sleep(2000);
		if (!BitStatus(QuadMonitor.quad.ReadState, 6))
		{
			Invoke((MethodInvoker)delegate
			{
				listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.FailedSwitchWorking"));
				listInfo.Refresh();
			});
			isTune = false;
			return;
		}
		int oldfreq = QuadMonitor.quad.ReadFreq;
		int mass = 101;
		Invoke((MethodInvoker)delegate
		{
			listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SuspendValue"), mass));
		});
		int sleeptime = 5000;
		int delta = 500;
		int indelta = 500;
		while (mass < 250)
		{
			if (!isTune || isError)
			{
				return;
			}
			RFManager.rfs.suspend = mass;
			Detector.Instance.msDetectorRF.SetSuspend(false);
			if (!StartScan())
			{
				QuadMonitor.quad.Freq = oldfreq;
				QuadMonitor.Instance.SetFreq();
				isTune = false;
				isError = true;
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.CollectionError")));
				});
				return;
			}
			Thread.Sleep(sleeptime);
			Invoke((MethodInvoker)delegate
			{
				listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.LVVoltageValue"), QuadMonitor.quad.ReadLV));
			});
			int trytimes = 0;
			int Freq = QuadMonitor.quad.ReadFreq;
			while (BitStatus(QuadMonitor.quad.ReadState, 2) || BitStatus(QuadMonitor.quad.ReadState, 3))
			{
				if (trytimes >= 3)
				{
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetQuadVoltage"), QuadMonitor.quad.Freq));
					});
					QuadMonitor.quad.Freq = Freq;
					QuadMonitor.Instance.SetFreq();
					Thread.Sleep(sleeptime);
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.FirstAttemptFailed")));
					});
					break;
				}
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.QuadRFPowerError")));
				});
				QuadMonitor.quad.Freq = QuadMonitor.quad.ReadFreq + 1000;
				QuadMonitor.Instance.SetFreq();
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetQuadVoltageTimes"), trytimes + 1, QuadMonitor.quad.Freq));
				});
				Thread.Sleep(sleeptime);
				RFManager.rfs.suspend = mass;
				Detector.Instance.msDetectorRF.SetSuspend(false);
				if (!StartScan())
				{
					QuadMonitor.quad.Freq = oldfreq;
					QuadMonitor.Instance.SetFreq();
					isTune = false;
					isError = true;
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.CollectionError")));
					});
					return;
				}
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetSuspendValue"), mass));
				});
				Thread.Sleep(sleeptime);
				trytimes++;
				Thread.Sleep(sleeptime);
				if (!isTune)
				{
					break;
				}
			}
			if (BitStatus(QuadMonitor.quad.ReadState, 2) || BitStatus(QuadMonitor.quad.ReadState, 3))
			{
				mass -= 20;
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.LoweringSuspendValue"), mass));
				});
				RFManager.rfs.suspend = mass;
				Detector.Instance.msDetectorRF.SetSuspend(false);
				if (!StartScan())
				{
					QuadMonitor.quad.Freq = oldfreq;
					QuadMonitor.Instance.SetFreq();
					isTune = false;
					isError = true;
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.CollectionError")));
					});
					return;
				}
				Thread.Sleep(sleeptime);
				if (!BitStatus(QuadMonitor.quad.ReadState, 2) && !BitStatus(QuadMonitor.quad.ReadState, 3))
				{
					continue;
				}
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.LoweringSuspendValueFailed"));
				});
				if (MessageBox.Show(Lang.Txt("AddFormQuad.PleaseRestoreNormalTuning"), Lang.Txt("AddFormIonSource.Warn"), MessageBoxButtons.OKCancel) == DialogResult.Cancel)
				{
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.CancelTuning"));
						listInfo.Refresh();
					});
					isTune = false;
					return;
				}
				QuadMonitor.Instance.Off48V();
				Thread.Sleep(1000);
				QuadMonitor.Instance.On48V();
				Thread.Sleep(5000);
				if (!BitStatus(QuadMonitor.quad.ReadState, 2) && !BitStatus(QuadMonitor.quad.ReadState, 3))
				{
					continue;
				}
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.TuningFailed"));
					listInfo.Refresh();
				});
				isTune = false;
				return;
			}
			if (QuadMonitor.quad.ReadLV > 8.0)
			{
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.LVVltage"), QuadMonitor.quad.ReadLV));
				});
				_LVMin = QuadMonitor.quad.ReadLV;
				_FreqMin = QuadMonitor.quad.ReadFreq;
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.LVVoltageValue"), QuadMonitor.quad.ReadLV));
				});
				int step = ((mass > 200) ? 1000 : 1000);
				QuadMonitor.quad.Freq += step;
				QuadMonitor.Instance.SetFreq();
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetQuadFrequency"), QuadMonitor.quad.Freq));
				});
				Thread.Sleep(sleeptime);
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.LVVoltageValue"), QuadMonitor.quad.ReadLV));
				});
				if (QuadMonitor.quad.ReadLV < _LVMin)
				{
					indelta = step;
				}
				else
				{
					indelta = -step;
				}
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.DetermineStepValue2"), indelta));
				});
				QuadMonitor.quad.Freq = _FreqMin;
				while (true)
				{
					if (!isTune || isError)
					{
						return;
					}
					QuadMonitor.quad.Freq += indelta;
					QuadMonitor.Instance.SetFreq();
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetQuadFrequency"), QuadMonitor.quad.Freq));
					});
					Thread.Sleep(sleeptime);
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, string.Format("Lang.Txt(LngRes.AddFormQuad.LVVltageIs)", QuadMonitor.quad.ReadLV));
					});
					RFManager.rfs.suspend = mass;
					Detector.Instance.msDetectorRF.SetSuspend(false);
					if (!StartScan())
					{
						QuadMonitor.quad.Freq = oldfreq;
						QuadMonitor.Instance.SetFreq();
						isTune = false;
						isError = true;
						Invoke((MethodInvoker)delegate
						{
							listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.CollectionError")));
						});
						return;
					}
					Thread.Sleep(sleeptime);
					if (!(QuadMonitor.quad.ReadLV < _LVMin))
					{
						break;
					}
					_LVMin = QuadMonitor.quad.ReadLV;
					_FreqMin = QuadMonitor.quad.Freq;
					bool flag = true;
				}
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.OptimalWorkingFrequency"), _FreqMin));
				});
				QuadMonitor.quad.Freq = _FreqMin;
				QuadMonitor.Instance.SetFreq();
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format("Lang.Txt(LngRes.AddFormQuad.LVVltageIs)", _LVMin));
				});
				QuadMonitor.quad.Freq = _FreqMin;
				QuadMonitor.Instance.SetFreq();
				Thread.Sleep(sleeptime);
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetQuadFrequency"), QuadMonitor.quad.Freq));
				});
			}
			if (QuadMonitor.quad.ReadLV > 12.0)
			{
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.DriveLVReachedMax"), (mass > 230) ? (mass - 1) : (mass - 5)));
					listInfo.Refresh();
				});
				isTune = false;
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetSuspendValue"), mass));
				});
				RFManager.rfs.suspend = 101.0;
				Detector.Instance.msDetectorRF.SetSuspend(false);
				if (!StartScan())
				{
					QuadMonitor.quad.Freq = oldfreq;
					QuadMonitor.Instance.SetFreq();
					isTune = false;
					isError = true;
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.CollectionError")));
					});
				}
				return;
			}
			if (mass < 230)
			{
				mass += 5;
				sleeptime = 5000;
			}
			else
			{
				mass++;
				sleeptime = 10000;
			}
			Detector.Instance.msDetectorRF.SetSuspend(false);
			Invoke((MethodInvoker)delegate
			{
				listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SuspendValueIs"), mass));
			});
		}
		isTune = false;
		Invoke((MethodInvoker)delegate
		{
			listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetSuspendValue"), 101));
		});
		Detector.Instance.msDetectorRF.SetM(101.0, (double)QuadMonitor.quad.ReadFreq);
	}

	private void btnTuneSecond_Click(object sender, EventArgs e)
	{
		if (Vacuum.vacumm.ReadVacuum[2] > 0.0004)
		{
			MessageBox.Show(Lang.Txt("AddFormQuad.QuadVacuumNotReached"), Lang.Txt("AddFormIonSource.Warn"), MessageBoxButtons.OK);
			return;
		}
		if (isTune)
		{
			MessageBox.Show(Lang.Txt("AddFormQuad.PleaseStopTuning"), Lang.Txt("AddFormIonSource.Warn"), MessageBoxButtons.OK);
			return;
		}
		isTune = true;
		Task.Factory.StartNew(delegate
		{
			if (Detector.detectorConfig.IsNewBoard)
			{
				TuneSecond();
			}
			else
			{
				TuneSecondForOld();
			}
		});
	}

	private bool StartScan()
	{
		if (Detector.Instance.ExperimentState != -1)
		{
			if (Detector.Instance.ExperimentState == 4)
			{
				MessageBox.Show(Lang.Txt("AddFormQuad.PleaseWaitComplete"), Lang.Txt("AddFormIonSource.Warn"), MessageBoxButtons.OK);
				return false;
			}
			if (MessageBox.Show(Lang.Txt("AddFormQuad.StopOtherTests"), Lang.Txt("AddFormIonSource.Warn"), MessageBoxButtons.YesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly) != DialogResult.Yes)
			{
				return false;
			}
			Detector.Instance.ExperimentStateChange(Detector.Instance.ExperimentState);
		}
		Detector.Instance.ExperimentState = 4;
		MassData ms = new MassData();
		ms.start = 20f;
		ms.end = 25f;
		ms.kDC = 1f;
		ms.kRF = 1f;
		ms.channels = 1;
		SetCalibrationFactor(ms);
		List<double> mass = SetMassAxis(ms);
		scanEvent.Reset();
		Detector.Instance.SetMassAxis(mass.ToArray());
		List<int> res = new List<int>();
		for (int i = 0; i < mass.Count; i++)
		{
			res.Add(1);
		}
		Detector.Instance.SendHopDatas(mass.ToArray(), res.ToArray(), true, true);
		if (!scanEvent.WaitOne(30000))
		{
			MessageBox.Show(Lang.Txt("AddFormQuad.CollectionError30s"), Lang.Txt("AddFormIonSource.Warn"), MessageBoxButtons.OK);
			scanEvent.Set();
			Detector.Instance.Stop();
			Detector.Instance.ExperimentState = -1;
			return false;
		}
		if (Detector.AcquistionState == 2)
		{
			MessageBox.Show(Lang.Txt("AddFormQuad.CollectionError30s"), Lang.Txt("AddFormIonSource.Warn"), MessageBoxButtons.OK);
			scanEvent.Set();
			Detector.Instance.Stop();
			Detector.Instance.ExperimentState = -1;
			return false;
		}
		scanEvent.Set();
		Detector.Instance.Stop();
		Detector.Instance.ExperimentState = -1;
		return true;
	}

	private void SetCalibrationFactor(MassData ms)
	{
		Detector.Instance.SetCalibrationFactor((double)ms.kRF, (double)ms.bRF, (double)ms.kDC, (double)ms.bDC);
	}

	private List<double> SetMassAxis(MassData ms)
	{
		float begin = ms.start;
		float end = ms.end;
		int channels = ms.channels;
		List<double> mass = new List<double>();
		for (float i = begin; i <= end; i += 1f / (float)channels)
		{
			mass.Add(i);
		}
		return mass;
	}

	private void btnStop_Click(object sender, EventArgs e)
	{
		if (MessageBox.Show(Lang.Txt("AddFormQuad.StopQuadFrequencyTuning"), Lang.Txt("AddFormIonSource.Warn"), MessageBoxButtons.YesNo) == DialogResult.Yes)
		{
			isTune = false;
		}
		Detector.Instance.msDetectorRF.SetM(101.0, (double)QuadMonitor.quad.ReadFreq);
	}

	private void button1_Click(object sender, EventArgs e)
	{
		if (!bCali)
		{
			bCali = true;
			FormWait wait = new FormWait();
			wait.Text = Lang.Txt("AddFormQuad.CorrectedQuadFactor");
			wait.Run += VCalibration;
			wait.ShowDialog();
			Log.InsertLog(Lang.Txt("AddFormIonSource.UserAction"), Lang.Txt("AddFormQuad.VoltageCorrection"), "", (Severity)1);
		}
	}

	private void VCalibration(object sender, EventArgs e)
	{
		if (QuadMonitor.quad.StatusConnected)
		{
			ProgressBar bar = sender as ProgressBar;
			List<double> RF = new List<double> { 1000.0, 2000.0, 5000.0, 10000.0, 20000.0, 30000.0, 40000.0, 50000.0 };
			List<double> DC = new List<double> { 1000.0, 2000.0, 5000.0, 10000.0, 20000.0, 30000.0, 40000.0, 50000.0 };
			List<double> Hex = new List<double> { 1000.0, 2000.0, 5000.0, 10000.0, 20000.0, 30000.0, 40000.0, 50000.0 };
			List<double> U = new List<double> { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
			List<double> V = new List<double> { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
			List<double> H = new List<double> { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
			PerformProgressStep(bar);
			double Etp = LensManager.x2lens.Etp;
			LensManager.Instance.CloseEtp();
			float HVP = RFManager.rfs.HVP;
			float HVN = RFManager.rfs.HVN;
			float Gate = RFManager.rfs.Gate;
			RFManager.rfs.HVP = 0f;
			RFManager.rfs.HVN = 0f;
			RFManager.rfs.Gate = 0f;
			if (Detector.detectorConfig.IsNewDetector)
			{
				Detector.Instance.msDetectorRF.SetHVPNew();
				Detector.Instance.msDetectorRF.SetHVNNew();
				Detector.Instance.msDetectorRF.SetGateNew();
			}
			else
			{
				Detector.Instance.msDetectorRF.SetHVP();
				Detector.Instance.msDetectorRF.SetHVN();
				Detector.Instance.msDetectorRF.SetGate();
			}
			PerformProgressStep(bar);
			for (int i = 0; i < RF.Count; i++)
			{
				Detector.Instance.msDetectorRF.SetM((ushort)RF[i], (ushort)DC[i], (ushort)Hex[i]);
				Thread.Sleep(10000);
				for (int j = 0; j < 8; j++)
				{
					U[i] += QuadMonitor.quad.ReadRF;
					V[i] += QuadMonitor.quad.ReadDC;
					H[i] += LensManager.x2lens.ReadHex;
					Thread.Sleep(2000);
					if (!bCali)
					{
						break;
					}
				}
				U[i] /= 8.0;
				V[i] /= 8.0;
				H[i] /= 8.0;
				PerformProgressStep(bar);
				if (!bCali)
				{
					Detector.Instance.msDetectorRF.SetSuspend(false);
					RFManager.rfs.HVP = HVP;
					RFManager.rfs.HVN = HVN;
					RFManager.rfs.Gate = Gate;
					if (Detector.detectorConfig.IsNewDetector)
					{
						Detector.Instance.msDetectorRF.SetHVPNew();
						Detector.Instance.msDetectorRF.SetHVNNew();
						Detector.Instance.msDetectorRF.SetGateNew();
					}
					else
					{
						Detector.Instance.msDetectorRF.SetHVP();
						Detector.Instance.msDetectorRF.SetHVN();
						Detector.Instance.msDetectorRF.SetGate();
					}
					LensManager.x2lens.Etp = Etp;
					LensManager.Instance.SetEtp();
					return;
				}
			}
			Detector.Instance.msDetectorRF.SetSuspend(false);
			RFManager.rfs.HVP = HVP;
			RFManager.rfs.HVN = HVN;
			RFManager.rfs.Gate = Gate;
			if (Detector.detectorConfig.IsNewDetector)
			{
				Detector.Instance.msDetectorRF.SetHVPNew();
				Detector.Instance.msDetectorRF.SetHVNNew();
				Detector.Instance.msDetectorRF.SetGateNew();
			}
			else
			{
				Detector.Instance.msDetectorRF.SetHVP();
				Detector.Instance.msDetectorRF.SetHVN();
				Detector.Instance.msDetectorRF.SetGate();
			}
			LensManager.x2lens.Etp = Etp;
			LensManager.Instance.SetEtp();
			double[] kbRF = LSFit.LineFit(U.ToArray(), RF.ToArray());
			double[] kbDC = LSFit.LineFit(V.ToArray(), DC.ToArray());
			double[] kbH = LSFit.LineFit(H.ToArray(), Hex.ToArray(), 0.0, 0.0, through: true);
			Invoke((MethodInvoker)delegate
			{
				nudACK0.Value = (decimal)kbRF[0];
				nudACB0.Value = (decimal)kbRF[1];
				nudDCK0.Value = (decimal)kbDC[0];
				nudDCB0.Value = (decimal)kbDC[1];
				nudHexK0.Value = (decimal)kbH[0];
				nudHexB0.Value = (decimal)kbH[1];
			});
		}
		bCali = false;
	}

	private void PerformProgressStep(ProgressBar bar)
	{
		Invoke((MethodInvoker)delegate
		{
			bar.PerformStep();
		});
	}

	private void button2_Click(object sender, EventArgs e)
	{
		if (bCali)
		{
			bCali = false;
		}
	}

	private void button3_Click(object sender, EventArgs e)
	{
		Detector.Instance.msDetectorRF.SetM(Convert.ToDouble(numericUpDown1.Value), (double)QuadMonitor.quad.ReadFreq);
	}

	private void button4_Click(object sender, EventArgs e)
	{
		if (Vacuum.vacumm.ReadVacuum[2] > 0.0004)
		{
			MessageBox.Show(Lang.Txt("AddFormQuad.QuadVacuumNotReached"));
			return;
		}
		zedGraphControl1.GraphPane.CurveList.Clear();
		zedGraphControl1.GraphPane.AddCurve(Lang.Txt("AddFormQuad.Curve"), new PointPairList(), Color.Blue, SymbolType.None);
		if (isTune)
		{
			MessageBox.Show(Lang.Txt("AddFormQuad.PleaseStopTuning"), Lang.Txt("AddFormIonSource.Warn"), MessageBoxButtons.OK);
			return;
		}
		List<double> freqList = new List<double>();
		List<double> RFList = new List<double>();
		isTune = true;
		Task.Factory.StartNew(delegate
		{
			Invoke((MethodInvoker)delegate
			{
				listInfo.Items.Clear();
				listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.StartQuadrupoleTuning"));
			});
			if (MessageBox.Show(Lang.Txt("AddFormQuad.MakeSureQuadrupoleturned"), Lang.Txt("AddFormIonSource.Warn"), MessageBoxButtons.OKCancel) == DialogResult.Cancel)
			{
				Invoke((MethodInvoker)delegate
				{
					listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.CancelTuning"));
					listInfo.Refresh();
				});
				isTune = false;
			}
			else
			{
				QuadMonitor.Instance.Off48V();
				Thread.Sleep(2000);
				if (BitStatus(QuadMonitor.quad.ReadState, 6))
				{
					Invoke((MethodInvoker)delegate
					{
						listInfo.Items.Insert(0, Lang.Txt("AddFormQuad.QuadModeSwitchFailed"));
						listInfo.Refresh();
					});
					isTune = false;
				}
				else
				{
					int num = 2000;
					QuadMonitor.quad.Freq = 2000000;
					while (isTune)
					{
						QuadMonitor.Instance.SetFreq();
						Invoke((MethodInvoker)delegate
						{
							listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.SetWorkingFrequency"), QuadMonitor.quad.Freq));
							listInfo.Refresh();
						});
						Thread.Sleep(3000);
						Invoke((MethodInvoker)delegate
						{
							listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.RFVoltage"), QuadMonitor.quad.ReadRF));
						});
						freqList.Add(QuadMonitor.quad.Freq);
						RFList.Add(QuadMonitor.quad.ReadRF);
						Invoke((MethodInvoker)delegate
						{
							zedGraphControl1.GraphPane.CurveList[0].AddPoint(QuadMonitor.quad.Freq, QuadMonitor.quad.ReadRF);
							zedGraphControl1.AxisChange();
							zedGraphControl1.Refresh();
						});
						QuadMonitor.quad.Freq += num;
						if (QuadMonitor.quad.Freq >= 2400000)
						{
							break;
						}
					}
					if (freqList.Count() > 0)
					{
						int num2 = RFList.FindIndex((double r) => r == RFList.Max());
						if (num2 >= 0)
						{
							QuadMonitor.quad.Freq = (int)freqList[num2];
							QuadMonitor.Instance.SetFreq();
							Invoke((MethodInvoker)delegate
							{
								listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.QuadModeSwitchFailed"), QuadMonitor.quad.Freq));
								listInfo.Refresh();
							});
						}
						else
						{
							Invoke((MethodInvoker)delegate
							{
								listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.QuadModeSwitchFailed")));
								listInfo.Refresh();
							});
						}
					}
					else
					{
						Invoke((MethodInvoker)delegate
						{
							listInfo.Items.Insert(0, string.Format(Lang.Txt("AddFormQuad.QuadModeSwitchFailed")));
							listInfo.Refresh();
						});
					}
					isTune = false;
				}
			}
		});
	}

	private void button5_Click(object sender, EventArgs e)
	{
		bClearPoints = true;
	}

	private void checkBox1_CheckedChanged(object sender, EventArgs e)
	{
		CheckBox c = sender as CheckBox;
		switch (c.Name)
		{
		case "checkBox1":
			graphTP.GraphPane.CurveList[0].IsVisible = c.Checked;
			break;
		case "checkBox2":
			graphTP.GraphPane.CurveList[1].IsVisible = c.Checked;
			break;
		case "checkBox3":
			graphRFDC.GraphPane.CurveList[0].IsVisible = c.Checked;
			break;
		case "checkBox4":
			graphRFDC.GraphPane.CurveList[1].IsVisible = c.Checked;
			break;
		}
	}

	private void gbCurve_Enter(object sender, EventArgs e)
	{
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		this.components = new System.ComponentModel.Container();
		this.btnQPok = new System.Windows.Forms.Button();
		this.gQuadParamemter = new System.Windows.Forms.GroupBox();
		this.btnTemperature = new System.Windows.Forms.Button();
		this.btnFreq = new System.Windows.Forms.Button();
		this.button3 = new System.Windows.Forms.Button();
		this.nudTune = new System.Windows.Forms.NumericUpDown();
		this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
		this.nudTemperature = new System.Windows.Forms.NumericUpDown();
		this.label1 = new System.Windows.Forms.Label();
		this.btnMatch = new System.Windows.Forms.Button();
		this.btn48VOff = new System.Windows.Forms.Button();
		this.label23 = new System.Windows.Forms.Label();
		this.label8 = new System.Windows.Forms.Label();
		this.btn48VOn = new System.Windows.Forms.Button();
		this.label7 = new System.Windows.Forms.Label();
		this.nudFreq = new System.Windows.Forms.NumericUpDown();
		this.label6 = new System.Windows.Forms.Label();
		this.nudDCB0 = new System.Windows.Forms.NumericUpDown();
		this.nudDCK0 = new System.Windows.Forms.NumericUpDown();
		this.nudACB0 = new System.Windows.Forms.NumericUpDown();
		this.label27 = new System.Windows.Forms.Label();
		this.nudACK0 = new System.Windows.Forms.NumericUpDown();
		this.label26 = new System.Windows.Forms.Label();
		this.label14 = new System.Windows.Forms.Label();
		this.label25 = new System.Windows.Forms.Label();
		this.gbQuadScanP = new System.Windows.Forms.GroupBox();
		this.button2 = new System.Windows.Forms.Button();
		this.button1 = new System.Windows.Forms.Button();
		this.label22 = new System.Windows.Forms.Label();
		this.label21 = new System.Windows.Forms.Label();
		this.nudHexB0 = new System.Windows.Forms.NumericUpDown();
		this.nudHexK0 = new System.Windows.Forms.NumericUpDown();
		this.gbQuadMonitor = new System.Windows.Forms.GroupBox();
		this.txtFreq = new System.Windows.Forms.TextBox();
		this.label20 = new System.Windows.Forms.Label();
		this.txt48V = new System.Windows.Forms.TextBox();
		this.label19 = new System.Windows.Forms.Label();
		this.txtHV = new System.Windows.Forms.TextBox();
		this.label5 = new System.Windows.Forms.Label();
		this.txtDC = new System.Windows.Forms.TextBox();
		this.label4 = new System.Windows.Forms.Label();
		this.txtRF = new System.Windows.Forms.TextBox();
		this.label3 = new System.Windows.Forms.Label();
		this.txtLV = new System.Windows.Forms.TextBox();
		this.label2 = new System.Windows.Forms.Label();
		this.txtPHeat = new System.Windows.Forms.TextBox();
		this.lblPower = new System.Windows.Forms.Label();
		this.txtT = new System.Windows.Forms.TextBox();
		this.lblTempertature = new System.Windows.Forms.Label();
		this.gbCurve = new System.Windows.Forms.GroupBox();
		this.checkBox4 = new System.Windows.Forms.CheckBox();
		this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
		this.graphTP = new ZedGraph.ZedGraphControl();
		this.graphRFDC = new ZedGraph.ZedGraphControl();
		this.checkBox3 = new System.Windows.Forms.CheckBox();
		this.button5 = new System.Windows.Forms.Button();
		this.checkBox2 = new System.Windows.Forms.CheckBox();
		this.graph2 = new ZedGraph.ZedGraphControl();
		this.checkBox1 = new System.Windows.Forms.CheckBox();
		this.btnCurve = new System.Windows.Forms.Button();
		this.graph = new ZedGraph.ZedGraphControl();
		this.gbQuadStatus = new System.Windows.Forms.GroupBox();
		this.pbStatusErI = new System.Windows.Forms.PictureBox();
		this.label18 = new System.Windows.Forms.Label();
		this.pbStatusTune = new System.Windows.Forms.PictureBox();
		this.label17 = new System.Windows.Forms.Label();
		this.pbStatusRelay = new System.Windows.Forms.PictureBox();
		this.label16 = new System.Windows.Forms.Label();
		this.pbStatus48V = new System.Windows.Forms.PictureBox();
		this.label15 = new System.Windows.Forms.Label();
		this.pbStatusBias = new System.Windows.Forms.PictureBox();
		this.label11 = new System.Windows.Forms.Label();
		this.pbStatusRF = new System.Windows.Forms.PictureBox();
		this.label10 = new System.Windows.Forms.Label();
		this.pbStatusMod = new System.Windows.Forms.PictureBox();
		this.label13 = new System.Windows.Forms.Label();
		this.pbStatusDCNeg = new System.Windows.Forms.PictureBox();
		this.label12 = new System.Windows.Forms.Label();
		this.pbStatusDcPlus = new System.Windows.Forms.PictureBox();
		this.label9 = new System.Windows.Forms.Label();
		this.tabControl1 = new System.Windows.Forms.TabControl();
		this.pageQuad = new System.Windows.Forms.TabPage();
		this.groupBox1 = new System.Windows.Forms.GroupBox();
		this.button4 = new System.Windows.Forms.Button();
		this.zedGraphControl1 = new ZedGraph.ZedGraphControl();
		this.btnStop = new System.Windows.Forms.Button();
		this.btnTuneSecond = new System.Windows.Forms.Button();
		this.btnTuneFirst = new System.Windows.Forms.Button();
		this.listInfo = new System.Windows.Forms.ListBox();
		this.pageQuadMonitor = new System.Windows.Forms.TabPage();
		this.gQuadParamemter.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.nudTune).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.numericUpDown1).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.nudTemperature).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.nudFreq).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.nudDCB0).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.nudDCK0).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.nudACB0).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.nudACK0).BeginInit();
		this.gbQuadScanP.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.nudHexB0).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.nudHexK0).BeginInit();
		this.gbQuadMonitor.SuspendLayout();
		this.gbCurve.SuspendLayout();
		this.tableLayoutPanel1.SuspendLayout();
		this.gbQuadStatus.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.pbStatusErI).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatusTune).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatusRelay).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatus48V).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatusBias).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatusRF).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatusMod).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatusDCNeg).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatusDcPlus).BeginInit();
		this.tabControl1.SuspendLayout();
		this.pageQuad.SuspendLayout();
		this.groupBox1.SuspendLayout();
		this.pageQuadMonitor.SuspendLayout();
		base.SuspendLayout();
		this.btnQPok.Location = new System.Drawing.Point(685, 24);
		this.btnQPok.Margin = new System.Windows.Forms.Padding(4);
		this.btnQPok.Name = "btnQPok";
		this.btnQPok.Size = new System.Drawing.Size(114, 38);
		this.btnQPok.TabIndex = 3;
		this.btnQPok.Text = "设定";
		this.btnQPok.UseVisualStyleBackColor = true;
		this.btnQPok.Click += new System.EventHandler(btnQPok_Click);
		this.gQuadParamemter.Controls.Add(this.btnTemperature);
		this.gQuadParamemter.Controls.Add(this.btnFreq);
		this.gQuadParamemter.Controls.Add(this.button3);
		this.gQuadParamemter.Controls.Add(this.nudTune);
		this.gQuadParamemter.Controls.Add(this.numericUpDown1);
		this.gQuadParamemter.Controls.Add(this.nudTemperature);
		this.gQuadParamemter.Controls.Add(this.label1);
		this.gQuadParamemter.Controls.Add(this.btnMatch);
		this.gQuadParamemter.Controls.Add(this.btn48VOff);
		this.gQuadParamemter.Controls.Add(this.label23);
		this.gQuadParamemter.Controls.Add(this.label8);
		this.gQuadParamemter.Controls.Add(this.btn48VOn);
		this.gQuadParamemter.Controls.Add(this.label7);
		this.gQuadParamemter.Controls.Add(this.nudFreq);
		this.gQuadParamemter.Controls.Add(this.label6);
		this.gQuadParamemter.Location = new System.Drawing.Point(176, 333);
		this.gQuadParamemter.Margin = new System.Windows.Forms.Padding(4);
		this.gQuadParamemter.Name = "gQuadParamemter";
		this.gQuadParamemter.Padding = new System.Windows.Forms.Padding(4);
		this.gQuadParamemter.Size = new System.Drawing.Size(335, 219);
		this.gQuadParamemter.TabIndex = 2;
		this.gQuadParamemter.TabStop = false;
		this.gQuadParamemter.Text = "四极杆参数";
		this.btnTemperature.Location = new System.Drawing.Point(256, 62);
		this.btnTemperature.Margin = new System.Windows.Forms.Padding(4);
		this.btnTemperature.Name = "btnTemperature";
		this.btnTemperature.Size = new System.Drawing.Size(75, 29);
		this.btnTemperature.TabIndex = 27;
		this.btnTemperature.Text = "设置";
		this.btnTemperature.UseVisualStyleBackColor = true;
		this.btnTemperature.Click += new System.EventHandler(btnTemperature_Click);
		this.btnFreq.Location = new System.Drawing.Point(256, 24);
		this.btnFreq.Margin = new System.Windows.Forms.Padding(4);
		this.btnFreq.Name = "btnFreq";
		this.btnFreq.Size = new System.Drawing.Size(75, 29);
		this.btnFreq.TabIndex = 26;
		this.btnFreq.Text = "设置";
		this.btnFreq.UseVisualStyleBackColor = true;
		this.btnFreq.Click += new System.EventHandler(btnFreq_Click);
		this.button3.Location = new System.Drawing.Point(256, 166);
		this.button3.Name = "button3";
		this.button3.Size = new System.Drawing.Size(72, 31);
		this.button3.TabIndex = 4;
		this.button3.Text = "设置";
		this.button3.UseVisualStyleBackColor = true;
		this.button3.Click += new System.EventHandler(button3_Click);
		this.nudTune.Increment = new decimal(new int[4] { 100, 0, 0, 0 });
		this.nudTune.Location = new System.Drawing.Point(148, 132);
		this.nudTune.Margin = new System.Windows.Forms.Padding(4);
		this.nudTune.Maximum = new decimal(new int[4] { 2500000, 0, 0, 0 });
		this.nudTune.Name = "nudTune";
		this.nudTune.Size = new System.Drawing.Size(103, 25);
		this.nudTune.TabIndex = 25;
		this.nudTune.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.nudTune.Value = new decimal(new int[4] { 2000000, 0, 0, 0 });
		this.numericUpDown1.Location = new System.Drawing.Point(148, 171);
		this.numericUpDown1.Maximum = new decimal(new int[4] { 300, 0, 0, 0 });
		this.numericUpDown1.Minimum = new decimal(new int[4] { 1, 0, 0, 0 });
		this.numericUpDown1.Name = "numericUpDown1";
		this.numericUpDown1.Size = new System.Drawing.Size(102, 25);
		this.numericUpDown1.TabIndex = 3;
		this.numericUpDown1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.numericUpDown1.Value = new decimal(new int[4] { 1, 0, 0, 0 });
		this.nudTemperature.Location = new System.Drawing.Point(148, 61);
		this.nudTemperature.Margin = new System.Windows.Forms.Padding(4);
		this.nudTemperature.Maximum = new decimal(new int[4] { 60, 0, 0, 0 });
		this.nudTemperature.Minimum = new decimal(new int[4] { 30, 0, 0, 0 });
		this.nudTemperature.Name = "nudTemperature";
		this.nudTemperature.Size = new System.Drawing.Size(103, 25);
		this.nudTemperature.TabIndex = 24;
		this.nudTemperature.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.nudTemperature.Value = new decimal(new int[4] { 50, 0, 0, 0 });
		this.label1.Location = new System.Drawing.Point(8, 64);
		this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(128, 19);
		this.label1.TabIndex = 23;
		this.label1.Text = "工作温度(℃):";
		this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.btnMatch.Location = new System.Drawing.Point(256, 132);
		this.btnMatch.Margin = new System.Windows.Forms.Padding(4);
		this.btnMatch.Name = "btnMatch";
		this.btnMatch.Size = new System.Drawing.Size(75, 29);
		this.btnMatch.TabIndex = 22;
		this.btnMatch.Text = "调谐";
		this.btnMatch.UseVisualStyleBackColor = true;
		this.btnMatch.Click += new System.EventHandler(btnMatch_Click);
		this.btn48VOff.Location = new System.Drawing.Point(256, 95);
		this.btn48VOff.Margin = new System.Windows.Forms.Padding(4);
		this.btn48VOff.Name = "btn48VOff";
		this.btn48VOff.Size = new System.Drawing.Size(75, 29);
		this.btn48VOff.TabIndex = 21;
		this.btn48VOff.Text = "关";
		this.btn48VOff.UseVisualStyleBackColor = true;
		this.btn48VOff.Click += new System.EventHandler(btn48VOff_Click);
		this.label23.Location = new System.Drawing.Point(34, 174);
		this.label23.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label23.Name = "label23";
		this.label23.Size = new System.Drawing.Size(107, 19);
		this.label23.TabIndex = 20;
		this.label23.Text = "设置电压：";
		this.label23.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.label8.Location = new System.Drawing.Point(29, 134);
		this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label8.Name = "label8";
		this.label8.Size = new System.Drawing.Size(107, 19);
		this.label8.TabIndex = 20;
		this.label8.Text = "匹配调谐:";
		this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.btn48VOn.Location = new System.Drawing.Point(148, 95);
		this.btn48VOn.Margin = new System.Windows.Forms.Padding(4);
		this.btn48VOn.Name = "btn48VOn";
		this.btn48VOn.Size = new System.Drawing.Size(103, 29);
		this.btn48VOn.TabIndex = 19;
		this.btn48VOn.Text = "开";
		this.btn48VOn.UseVisualStyleBackColor = true;
		this.btn48VOn.Click += new System.EventHandler(btn48VOn_Click);
		this.label7.Location = new System.Drawing.Point(29, 101);
		this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label7.Name = "label7";
		this.label7.Size = new System.Drawing.Size(107, 19);
		this.label7.TabIndex = 18;
		this.label7.Text = "48V继电器:";
		this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.nudFreq.Location = new System.Drawing.Point(148, 26);
		this.nudFreq.Margin = new System.Windows.Forms.Padding(4);
		this.nudFreq.Maximum = new decimal(new int[4] { 2300000, 0, 0, 0 });
		this.nudFreq.Name = "nudFreq";
		this.nudFreq.Size = new System.Drawing.Size(103, 25);
		this.nudFreq.TabIndex = 17;
		this.nudFreq.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.nudFreq.Value = new decimal(new int[4] { 2000000, 0, 0, 0 });
		this.label6.Location = new System.Drawing.Point(21, 29);
		this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label6.Name = "label6";
		this.label6.Size = new System.Drawing.Size(115, 19);
		this.label6.TabIndex = 16;
		this.label6.Text = "工作频率(Hz):";
		this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.nudDCB0.DecimalPlaces = 2;
		this.nudDCB0.Increment = new decimal(new int[4] { 1, 0, 0, 131072 });
		this.nudDCB0.Location = new System.Drawing.Point(391, 59);
		this.nudDCB0.Margin = new System.Windows.Forms.Padding(4);
		this.nudDCB0.Maximum = new decimal(new int[4] { 10000, 0, 0, 0 });
		this.nudDCB0.Minimum = new decimal(new int[4] { 10000, 0, 0, -2147483648 });
		this.nudDCB0.Name = "nudDCB0";
		this.nudDCB0.Size = new System.Drawing.Size(103, 25);
		this.nudDCB0.TabIndex = 15;
		this.nudDCB0.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.nudDCK0.DecimalPlaces = 2;
		this.nudDCK0.Increment = new decimal(new int[4] { 1, 0, 0, 131072 });
		this.nudDCK0.Location = new System.Drawing.Point(148, 59);
		this.nudDCK0.Margin = new System.Windows.Forms.Padding(4);
		this.nudDCK0.Maximum = new decimal(new int[4] { 10000, 0, 0, 0 });
		this.nudDCK0.Minimum = new decimal(new int[4] { 10000, 0, 0, -2147483648 });
		this.nudDCK0.Name = "nudDCK0";
		this.nudDCK0.Size = new System.Drawing.Size(103, 25);
		this.nudDCK0.TabIndex = 14;
		this.nudDCK0.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.nudDCK0.Value = new decimal(new int[4] { 1, 0, 0, 0 });
		this.nudACB0.DecimalPlaces = 2;
		this.nudACB0.Increment = new decimal(new int[4] { 1, 0, 0, 131072 });
		this.nudACB0.Location = new System.Drawing.Point(392, 25);
		this.nudACB0.Margin = new System.Windows.Forms.Padding(4);
		this.nudACB0.Maximum = new decimal(new int[4] { 10000, 0, 0, 0 });
		this.nudACB0.Minimum = new decimal(new int[4] { 10000, 0, 0, -2147483648 });
		this.nudACB0.Name = "nudACB0";
		this.nudACB0.Size = new System.Drawing.Size(103, 25);
		this.nudACB0.TabIndex = 13;
		this.nudACB0.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.label27.Location = new System.Drawing.Point(48, 21);
		this.label27.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label27.Name = "label27";
		this.label27.Size = new System.Drawing.Size(85, 29);
		this.label27.TabIndex = 8;
		this.label27.Text = "RF-k0:";
		this.label27.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.nudACK0.DecimalPlaces = 2;
		this.nudACK0.Increment = new decimal(new int[4] { 1, 0, 0, 131072 });
		this.nudACK0.Location = new System.Drawing.Point(148, 25);
		this.nudACK0.Margin = new System.Windows.Forms.Padding(4);
		this.nudACK0.Maximum = new decimal(new int[4] { 10000, 0, 0, 0 });
		this.nudACK0.Minimum = new decimal(new int[4] { 10000, 0, 0, -2147483648 });
		this.nudACK0.Name = "nudACK0";
		this.nudACK0.Size = new System.Drawing.Size(103, 25);
		this.nudACK0.TabIndex = 12;
		this.nudACK0.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.nudACK0.Value = new decimal(new int[4] { 1, 0, 0, 0 });
		this.label26.Location = new System.Drawing.Point(261, 22);
		this.label26.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label26.Name = "label26";
		this.label26.Size = new System.Drawing.Size(116, 29);
		this.label26.TabIndex = 9;
		this.label26.Text = "RF-b0:";
		this.label26.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.label14.Location = new System.Drawing.Point(261, 55);
		this.label14.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label14.Name = "label14";
		this.label14.Size = new System.Drawing.Size(116, 29);
		this.label14.TabIndex = 11;
		this.label14.Text = "DC-b0:";
		this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.label25.Location = new System.Drawing.Point(17, 55);
		this.label25.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label25.Name = "label25";
		this.label25.Size = new System.Drawing.Size(116, 29);
		this.label25.TabIndex = 10;
		this.label25.Text = "DC-k0:";
		this.label25.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.gbQuadScanP.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.gbQuadScanP.Controls.Add(this.button2);
		this.gbQuadScanP.Controls.Add(this.button1);
		this.gbQuadScanP.Controls.Add(this.label22);
		this.gbQuadScanP.Controls.Add(this.label21);
		this.gbQuadScanP.Controls.Add(this.label27);
		this.gbQuadScanP.Controls.Add(this.nudHexB0);
		this.gbQuadScanP.Controls.Add(this.nudHexK0);
		this.gbQuadScanP.Controls.Add(this.nudACB0);
		this.gbQuadScanP.Controls.Add(this.nudACK0);
		this.gbQuadScanP.Controls.Add(this.nudDCK0);
		this.gbQuadScanP.Controls.Add(this.label25);
		this.gbQuadScanP.Controls.Add(this.label26);
		this.gbQuadScanP.Controls.Add(this.nudDCB0);
		this.gbQuadScanP.Controls.Add(this.btnQPok);
		this.gbQuadScanP.Controls.Add(this.label14);
		this.gbQuadScanP.Location = new System.Drawing.Point(17, 570);
		this.gbQuadScanP.Margin = new System.Windows.Forms.Padding(4);
		this.gbQuadScanP.Name = "gbQuadScanP";
		this.gbQuadScanP.Padding = new System.Windows.Forms.Padding(4);
		this.gbQuadScanP.Size = new System.Drawing.Size(1533, 123);
		this.gbQuadScanP.TabIndex = 4;
		this.gbQuadScanP.TabStop = false;
		this.gbQuadScanP.Text = "四极杆扫描参数";
		this.button2.Location = new System.Drawing.Point(857, 21);
		this.button2.Name = "button2";
		this.button2.Size = new System.Drawing.Size(114, 38);
		this.button2.TabIndex = 17;
		this.button2.Text = "取消";
		this.button2.UseVisualStyleBackColor = true;
		this.button2.Click += new System.EventHandler(button2_Click);
		this.button1.Location = new System.Drawing.Point(542, 24);
		this.button1.Name = "button1";
		this.button1.Size = new System.Drawing.Size(114, 38);
		this.button1.TabIndex = 16;
		this.button1.Text = "校正";
		this.button1.UseVisualStyleBackColor = true;
		this.button1.Click += new System.EventHandler(button1_Click);
		this.label22.Location = new System.Drawing.Point(291, 90);
		this.label22.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label22.Name = "label22";
		this.label22.Size = new System.Drawing.Size(85, 29);
		this.label22.TabIndex = 8;
		this.label22.Text = "Hex-b0:";
		this.label22.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.label21.Location = new System.Drawing.Point(48, 90);
		this.label21.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label21.Name = "label21";
		this.label21.Size = new System.Drawing.Size(85, 29);
		this.label21.TabIndex = 8;
		this.label21.Text = "Hex-k0:";
		this.label21.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.nudHexB0.DecimalPlaces = 2;
		this.nudHexB0.Increment = new decimal(new int[4] { 1, 0, 0, 131072 });
		this.nudHexB0.Location = new System.Drawing.Point(392, 94);
		this.nudHexB0.Margin = new System.Windows.Forms.Padding(4);
		this.nudHexB0.Maximum = new decimal(new int[4] { 10000, 0, 0, 0 });
		this.nudHexB0.Minimum = new decimal(new int[4] { 10000, 0, 0, -2147483648 });
		this.nudHexB0.Name = "nudHexB0";
		this.nudHexB0.Size = new System.Drawing.Size(103, 25);
		this.nudHexB0.TabIndex = 12;
		this.nudHexB0.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.nudHexB0.Value = new decimal(new int[4] { 1, 0, 0, 0 });
		this.nudHexK0.DecimalPlaces = 2;
		this.nudHexK0.Increment = new decimal(new int[4] { 1, 0, 0, 131072 });
		this.nudHexK0.Location = new System.Drawing.Point(148, 92);
		this.nudHexK0.Margin = new System.Windows.Forms.Padding(4);
		this.nudHexK0.Maximum = new decimal(new int[4] { 10000, 0, 0, 0 });
		this.nudHexK0.Minimum = new decimal(new int[4] { 10000, 0, 0, -2147483648 });
		this.nudHexK0.Name = "nudHexK0";
		this.nudHexK0.Size = new System.Drawing.Size(103, 25);
		this.nudHexK0.TabIndex = 12;
		this.nudHexK0.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.nudHexK0.Value = new decimal(new int[4] { 1, 0, 0, 0 });
		this.gbQuadMonitor.Controls.Add(this.txtFreq);
		this.gbQuadMonitor.Controls.Add(this.label20);
		this.gbQuadMonitor.Controls.Add(this.txt48V);
		this.gbQuadMonitor.Controls.Add(this.label19);
		this.gbQuadMonitor.Controls.Add(this.txtHV);
		this.gbQuadMonitor.Controls.Add(this.label5);
		this.gbQuadMonitor.Controls.Add(this.txtDC);
		this.gbQuadMonitor.Controls.Add(this.label4);
		this.gbQuadMonitor.Controls.Add(this.txtRF);
		this.gbQuadMonitor.Controls.Add(this.label3);
		this.gbQuadMonitor.Controls.Add(this.txtLV);
		this.gbQuadMonitor.Controls.Add(this.label2);
		this.gbQuadMonitor.Controls.Add(this.txtPHeat);
		this.gbQuadMonitor.Controls.Add(this.lblPower);
		this.gbQuadMonitor.Controls.Add(this.txtT);
		this.gbQuadMonitor.Controls.Add(this.lblTempertature);
		this.gbQuadMonitor.Location = new System.Drawing.Point(176, 17);
		this.gbQuadMonitor.Margin = new System.Windows.Forms.Padding(4);
		this.gbQuadMonitor.Name = "gbQuadMonitor";
		this.gbQuadMonitor.Padding = new System.Windows.Forms.Padding(4);
		this.gbQuadMonitor.Size = new System.Drawing.Size(335, 309);
		this.gbQuadMonitor.TabIndex = 5;
		this.gbQuadMonitor.TabStop = false;
		this.gbQuadMonitor.Text = "四极杆监控";
		this.txtFreq.Location = new System.Drawing.Point(172, 269);
		this.txtFreq.Margin = new System.Windows.Forms.Padding(4);
		this.txtFreq.Name = "txtFreq";
		this.txtFreq.ReadOnly = true;
		this.txtFreq.Size = new System.Drawing.Size(132, 25);
		this.txtFreq.TabIndex = 11;
		this.txtFreq.Text = "--";
		this.txtFreq.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.label20.Location = new System.Drawing.Point(53, 270);
		this.label20.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label20.Name = "label20";
		this.label20.Size = new System.Drawing.Size(107, 19);
		this.label20.TabIndex = 10;
		this.label20.Text = "工作频率(Hz):";
		this.label20.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.txt48V.Location = new System.Drawing.Point(172, 234);
		this.txt48V.Margin = new System.Windows.Forms.Padding(4);
		this.txt48V.Name = "txt48V";
		this.txt48V.ReadOnly = true;
		this.txt48V.Size = new System.Drawing.Size(132, 25);
		this.txt48V.TabIndex = 9;
		this.txt48V.Text = "--";
		this.txt48V.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.label19.Location = new System.Drawing.Point(53, 238);
		this.label19.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label19.Name = "label19";
		this.label19.Size = new System.Drawing.Size(107, 19);
		this.label19.TabIndex = 8;
		this.label19.Text = "48V电流(A):";
		this.label19.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.txtHV.Location = new System.Drawing.Point(172, 199);
		this.txtHV.Margin = new System.Windows.Forms.Padding(4);
		this.txtHV.Name = "txtHV";
		this.txtHV.ReadOnly = true;
		this.txtHV.Size = new System.Drawing.Size(132, 25);
		this.txtHV.TabIndex = 7;
		this.txtHV.Text = "--";
		this.txtHV.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.label5.Location = new System.Drawing.Point(53, 202);
		this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label5.Name = "label5";
		this.label5.Size = new System.Drawing.Size(107, 19);
		this.label5.TabIndex = 6;
		this.label5.Text = "-HV(V):";
		this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.txtDC.Location = new System.Drawing.Point(172, 164);
		this.txtDC.Margin = new System.Windows.Forms.Padding(4);
		this.txtDC.Name = "txtDC";
		this.txtDC.ReadOnly = true;
		this.txtDC.Size = new System.Drawing.Size(132, 25);
		this.txtDC.TabIndex = 7;
		this.txtDC.Text = "--";
		this.txtDC.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.label4.Location = new System.Drawing.Point(53, 168);
		this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label4.Name = "label4";
		this.label4.Size = new System.Drawing.Size(107, 19);
		this.label4.TabIndex = 6;
		this.label4.Text = "+DC OUT(V):";
		this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.txtRF.Location = new System.Drawing.Point(172, 129);
		this.txtRF.Margin = new System.Windows.Forms.Padding(4);
		this.txtRF.Name = "txtRF";
		this.txtRF.ReadOnly = true;
		this.txtRF.Size = new System.Drawing.Size(132, 25);
		this.txtRF.TabIndex = 7;
		this.txtRF.Text = "--";
		this.txtRF.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.label3.Location = new System.Drawing.Point(53, 132);
		this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label3.Name = "label3";
		this.label3.Size = new System.Drawing.Size(107, 19);
		this.label3.TabIndex = 6;
		this.label3.Text = "RF VP(V):";
		this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.txtLV.Location = new System.Drawing.Point(172, 94);
		this.txtLV.Margin = new System.Windows.Forms.Padding(4);
		this.txtLV.Name = "txtLV";
		this.txtLV.ReadOnly = true;
		this.txtLV.Size = new System.Drawing.Size(132, 25);
		this.txtLV.TabIndex = 5;
		this.txtLV.Text = "--";
		this.txtLV.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.label2.Location = new System.Drawing.Point(53, 98);
		this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label2.Name = "label2";
		this.label2.Size = new System.Drawing.Size(107, 19);
		this.label2.TabIndex = 4;
		this.label2.Text = "Drive LV(V):";
		this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.txtPHeat.Location = new System.Drawing.Point(172, 59);
		this.txtPHeat.Margin = new System.Windows.Forms.Padding(4);
		this.txtPHeat.Name = "txtPHeat";
		this.txtPHeat.ReadOnly = true;
		this.txtPHeat.Size = new System.Drawing.Size(132, 25);
		this.txtPHeat.TabIndex = 3;
		this.txtPHeat.Text = "--";
		this.txtPHeat.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.lblPower.Location = new System.Drawing.Point(53, 62);
		this.lblPower.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.lblPower.Name = "lblPower";
		this.lblPower.Size = new System.Drawing.Size(107, 19);
		this.lblPower.TabIndex = 2;
		this.lblPower.Text = "加热功率(W):";
		this.lblPower.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.txtT.Location = new System.Drawing.Point(172, 24);
		this.txtT.Margin = new System.Windows.Forms.Padding(4);
		this.txtT.Name = "txtT";
		this.txtT.ReadOnly = true;
		this.txtT.Size = new System.Drawing.Size(132, 25);
		this.txtT.TabIndex = 1;
		this.txtT.Text = "--";
		this.txtT.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.lblTempertature.Location = new System.Drawing.Point(53, 28);
		this.lblTempertature.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.lblTempertature.Name = "lblTempertature";
		this.lblTempertature.Size = new System.Drawing.Size(107, 19);
		this.lblTempertature.TabIndex = 0;
		this.lblTempertature.Text = "温度(℃):";
		this.lblTempertature.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.gbCurve.Controls.Add(this.checkBox4);
		this.gbCurve.Controls.Add(this.tableLayoutPanel1);
		this.gbCurve.Controls.Add(this.checkBox3);
		this.gbCurve.Controls.Add(this.button5);
		this.gbCurve.Controls.Add(this.checkBox2);
		this.gbCurve.Controls.Add(this.graph2);
		this.gbCurve.Controls.Add(this.checkBox1);
		this.gbCurve.Controls.Add(this.btnCurve);
		this.gbCurve.Controls.Add(this.graph);
		this.gbCurve.Dock = System.Windows.Forms.DockStyle.Fill;
		this.gbCurve.Location = new System.Drawing.Point(3, 3);
		this.gbCurve.Margin = new System.Windows.Forms.Padding(4);
		this.gbCurve.Name = "gbCurve";
		this.gbCurve.Padding = new System.Windows.Forms.Padding(4);
		this.gbCurve.Size = new System.Drawing.Size(1856, 754);
		this.gbCurve.TabIndex = 6;
		this.gbCurve.TabStop = false;
		this.gbCurve.Text = "温度/加热功率";
		this.gbCurve.Enter += new System.EventHandler(gbCurve_Enter);
		this.checkBox4.AutoSize = true;
		this.checkBox4.Checked = true;
		this.checkBox4.CheckState = System.Windows.Forms.CheckState.Checked;
		this.checkBox4.Location = new System.Drawing.Point(946, 594);
		this.checkBox4.Name = "checkBox4";
		this.checkBox4.Size = new System.Drawing.Size(75, 19);
		this.checkBox4.TabIndex = 8;
		this.checkBox4.Text = "DC电压";
		this.checkBox4.UseVisualStyleBackColor = true;
		this.checkBox4.CheckedChanged += new System.EventHandler(checkBox1_CheckedChanged);
		this.tableLayoutPanel1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
		this.tableLayoutPanel1.ColumnCount = 1;
		this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50f));
		this.tableLayoutPanel1.Controls.Add(this.graphTP, 0, 0);
		this.tableLayoutPanel1.Controls.Add(this.graphRFDC, 0, 1);
		this.tableLayoutPanel1.Location = new System.Drawing.Point(5, 21);
		this.tableLayoutPanel1.Name = "tableLayoutPanel1";
		this.tableLayoutPanel1.RowCount = 2;
		this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50f));
		this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50f));
		this.tableLayoutPanel1.Size = new System.Drawing.Size(917, 726);
		this.tableLayoutPanel1.TabIndex = 10;
		this.graphTP.Dock = System.Windows.Forms.DockStyle.Fill;
		this.graphTP.Location = new System.Drawing.Point(5, 4);
		this.graphTP.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
		this.graphTP.Name = "graphTP";
		this.graphTP.ScrollGrace = 0.0;
		this.graphTP.ScrollMaxX = 0.0;
		this.graphTP.ScrollMaxY = 0.0;
		this.graphTP.ScrollMaxY2 = 0.0;
		this.graphTP.ScrollMinX = 0.0;
		this.graphTP.ScrollMinY = 0.0;
		this.graphTP.ScrollMinY2 = 0.0;
		this.graphTP.Size = new System.Drawing.Size(907, 355);
		this.graphTP.TabIndex = 2;
		this.graphRFDC.Dock = System.Windows.Forms.DockStyle.Fill;
		this.graphRFDC.Location = new System.Drawing.Point(5, 367);
		this.graphRFDC.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
		this.graphRFDC.Name = "graphRFDC";
		this.graphRFDC.ScrollGrace = 0.0;
		this.graphRFDC.ScrollMaxX = 0.0;
		this.graphRFDC.ScrollMaxY = 0.0;
		this.graphRFDC.ScrollMaxY2 = 0.0;
		this.graphRFDC.ScrollMinX = 0.0;
		this.graphRFDC.ScrollMinY = 0.0;
		this.graphRFDC.ScrollMinY2 = 0.0;
		this.graphRFDC.Size = new System.Drawing.Size(907, 355);
		this.graphRFDC.TabIndex = 8;
		this.checkBox3.AutoSize = true;
		this.checkBox3.Checked = true;
		this.checkBox3.CheckState = System.Windows.Forms.CheckState.Checked;
		this.checkBox3.Location = new System.Drawing.Point(946, 545);
		this.checkBox3.Name = "checkBox3";
		this.checkBox3.Size = new System.Drawing.Size(75, 19);
		this.checkBox3.TabIndex = 8;
		this.checkBox3.Text = "RF电压";
		this.checkBox3.UseVisualStyleBackColor = true;
		this.checkBox3.CheckedChanged += new System.EventHandler(checkBox1_CheckedChanged);
		this.button5.Location = new System.Drawing.Point(943, 63);
		this.button5.Margin = new System.Windows.Forms.Padding(4);
		this.button5.Name = "button5";
		this.button5.Size = new System.Drawing.Size(100, 29);
		this.button5.TabIndex = 7;
		this.button5.Text = "刷新";
		this.button5.UseVisualStyleBackColor = true;
		this.button5.Click += new System.EventHandler(button5_Click);
		this.checkBox2.AutoSize = true;
		this.checkBox2.Checked = true;
		this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
		this.checkBox2.Location = new System.Drawing.Point(943, 234);
		this.checkBox2.Name = "checkBox2";
		this.checkBox2.Size = new System.Drawing.Size(59, 19);
		this.checkBox2.TabIndex = 8;
		this.checkBox2.Text = "功率";
		this.checkBox2.UseVisualStyleBackColor = true;
		this.checkBox2.CheckedChanged += new System.EventHandler(checkBox1_CheckedChanged);
		this.graph2.Location = new System.Drawing.Point(1288, 26);
		this.graph2.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
		this.graph2.Name = "graph2";
		this.graph2.ScrollGrace = 0.0;
		this.graph2.ScrollMaxX = 0.0;
		this.graph2.ScrollMaxY = 0.0;
		this.graph2.ScrollMaxY2 = 0.0;
		this.graph2.ScrollMinX = 0.0;
		this.graph2.ScrollMinY = 0.0;
		this.graph2.ScrollMinY2 = 0.0;
		this.graph2.Size = new System.Drawing.Size(44, 19);
		this.graph2.TabIndex = 8;
		this.graph2.Visible = false;
		this.checkBox1.AutoSize = true;
		this.checkBox1.Checked = true;
		this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
		this.checkBox1.Location = new System.Drawing.Point(943, 179);
		this.checkBox1.Name = "checkBox1";
		this.checkBox1.Size = new System.Drawing.Size(59, 19);
		this.checkBox1.TabIndex = 8;
		this.checkBox1.Text = "温度";
		this.checkBox1.UseVisualStyleBackColor = true;
		this.checkBox1.CheckedChanged += new System.EventHandler(checkBox1_CheckedChanged);
		this.btnCurve.Location = new System.Drawing.Point(1363, 46);
		this.btnCurve.Margin = new System.Windows.Forms.Padding(4);
		this.btnCurve.Name = "btnCurve";
		this.btnCurve.Size = new System.Drawing.Size(100, 29);
		this.btnCurve.TabIndex = 7;
		this.btnCurve.Text = "刷新";
		this.btnCurve.UseVisualStyleBackColor = true;
		this.btnCurve.Visible = false;
		this.btnCurve.Click += new System.EventHandler(btnCurve_Click);
		this.graph.Location = new System.Drawing.Point(1243, 21);
		this.graph.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
		this.graph.Name = "graph";
		this.graph.ScrollGrace = 0.0;
		this.graph.ScrollMaxX = 0.0;
		this.graph.ScrollMaxY = 0.0;
		this.graph.ScrollMaxY2 = 0.0;
		this.graph.ScrollMinX = 0.0;
		this.graph.ScrollMinY = 0.0;
		this.graph.ScrollMinY2 = 0.0;
		this.graph.Size = new System.Drawing.Size(44, 57);
		this.graph.TabIndex = 2;
		this.graph.Visible = false;
		this.gbQuadStatus.Controls.Add(this.pbStatusErI);
		this.gbQuadStatus.Controls.Add(this.label18);
		this.gbQuadStatus.Controls.Add(this.pbStatusTune);
		this.gbQuadStatus.Controls.Add(this.label17);
		this.gbQuadStatus.Controls.Add(this.pbStatusRelay);
		this.gbQuadStatus.Controls.Add(this.label16);
		this.gbQuadStatus.Controls.Add(this.pbStatus48V);
		this.gbQuadStatus.Controls.Add(this.label15);
		this.gbQuadStatus.Controls.Add(this.pbStatusBias);
		this.gbQuadStatus.Controls.Add(this.label11);
		this.gbQuadStatus.Controls.Add(this.pbStatusRF);
		this.gbQuadStatus.Controls.Add(this.label10);
		this.gbQuadStatus.Controls.Add(this.pbStatusMod);
		this.gbQuadStatus.Controls.Add(this.label13);
		this.gbQuadStatus.Controls.Add(this.pbStatusDCNeg);
		this.gbQuadStatus.Controls.Add(this.label12);
		this.gbQuadStatus.Controls.Add(this.pbStatusDcPlus);
		this.gbQuadStatus.Controls.Add(this.label9);
		this.gbQuadStatus.Location = new System.Drawing.Point(25, 17);
		this.gbQuadStatus.Margin = new System.Windows.Forms.Padding(4);
		this.gbQuadStatus.Name = "gbQuadStatus";
		this.gbQuadStatus.Padding = new System.Windows.Forms.Padding(4);
		this.gbQuadStatus.Size = new System.Drawing.Size(143, 535);
		this.gbQuadStatus.TabIndex = 7;
		this.gbQuadStatus.TabStop = false;
		this.gbQuadStatus.Text = "四极杆状态";
		this.pbStatusErI.Image = ICP_MS.Plugin.Advance.Properties.Resources.led_Gray;
		this.pbStatusErI.Location = new System.Drawing.Point(104, 371);
		this.pbStatusErI.Margin = new System.Windows.Forms.Padding(4);
		this.pbStatusErI.Name = "pbStatusErI";
		this.pbStatusErI.Size = new System.Drawing.Size(31, 29);
		this.pbStatusErI.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
		this.pbStatusErI.TabIndex = 21;
		this.pbStatusErI.TabStop = false;
		this.label18.Location = new System.Drawing.Point(15, 378);
		this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label18.Name = "label18";
		this.label18.Size = new System.Drawing.Size(80, 19);
		this.label18.TabIndex = 20;
		this.label18.Text = "Er I:";
		this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.pbStatusTune.Image = ICP_MS.Plugin.Advance.Properties.Resources.led_Gray;
		this.pbStatusTune.Location = new System.Drawing.Point(104, 325);
		this.pbStatusTune.Margin = new System.Windows.Forms.Padding(4);
		this.pbStatusTune.Name = "pbStatusTune";
		this.pbStatusTune.Size = new System.Drawing.Size(31, 29);
		this.pbStatusTune.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
		this.pbStatusTune.TabIndex = 19;
		this.pbStatusTune.TabStop = false;
		this.label17.Location = new System.Drawing.Point(15, 331);
		this.label17.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label17.Name = "label17";
		this.label17.Size = new System.Drawing.Size(80, 19);
		this.label17.TabIndex = 18;
		this.label17.Text = "Tune:";
		this.label17.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.pbStatusRelay.Image = ICP_MS.Plugin.Advance.Properties.Resources.led_Gray;
		this.pbStatusRelay.Location = new System.Drawing.Point(104, 418);
		this.pbStatusRelay.Margin = new System.Windows.Forms.Padding(4);
		this.pbStatusRelay.Name = "pbStatusRelay";
		this.pbStatusRelay.Size = new System.Drawing.Size(31, 29);
		this.pbStatusRelay.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
		this.pbStatusRelay.TabIndex = 17;
		this.pbStatusRelay.TabStop = false;
		this.label16.Location = new System.Drawing.Point(15, 424);
		this.label16.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label16.Name = "label16";
		this.label16.Size = new System.Drawing.Size(80, 19);
		this.label16.TabIndex = 16;
		this.label16.Text = "Relay:";
		this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.pbStatus48V.Image = ICP_MS.Plugin.Advance.Properties.Resources.led_Gray;
		this.pbStatus48V.Location = new System.Drawing.Point(104, 280);
		this.pbStatus48V.Margin = new System.Windows.Forms.Padding(4);
		this.pbStatus48V.Name = "pbStatus48V";
		this.pbStatus48V.Size = new System.Drawing.Size(31, 29);
		this.pbStatus48V.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
		this.pbStatus48V.TabIndex = 15;
		this.pbStatus48V.TabStop = false;
		this.label15.Location = new System.Drawing.Point(15, 286);
		this.label15.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label15.Name = "label15";
		this.label15.Size = new System.Drawing.Size(80, 19);
		this.label15.TabIndex = 14;
		this.label15.Text = "+48V:";
		this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.pbStatusBias.Image = ICP_MS.Plugin.Advance.Properties.Resources.led_Gray;
		this.pbStatusBias.Location = new System.Drawing.Point(104, 234);
		this.pbStatusBias.Margin = new System.Windows.Forms.Padding(4);
		this.pbStatusBias.Name = "pbStatusBias";
		this.pbStatusBias.Size = new System.Drawing.Size(31, 29);
		this.pbStatusBias.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
		this.pbStatusBias.TabIndex = 13;
		this.pbStatusBias.TabStop = false;
		this.label11.Location = new System.Drawing.Point(15, 240);
		this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label11.Name = "label11";
		this.label11.Size = new System.Drawing.Size(80, 19);
		this.label11.TabIndex = 12;
		this.label11.Text = "预杆偏置:";
		this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.pbStatusRF.Image = ICP_MS.Plugin.Advance.Properties.Resources.led_Gray;
		this.pbStatusRF.Location = new System.Drawing.Point(104, 141);
		this.pbStatusRF.Margin = new System.Windows.Forms.Padding(4);
		this.pbStatusRF.Name = "pbStatusRF";
		this.pbStatusRF.Size = new System.Drawing.Size(31, 29);
		this.pbStatusRF.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
		this.pbStatusRF.TabIndex = 11;
		this.pbStatusRF.TabStop = false;
		this.label10.Location = new System.Drawing.Point(15, 148);
		this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label10.Name = "label10";
		this.label10.Size = new System.Drawing.Size(80, 19);
		this.label10.TabIndex = 10;
		this.label10.Text = "RF:";
		this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.pbStatusMod.Image = ICP_MS.Plugin.Advance.Properties.Resources.led_Gray;
		this.pbStatusMod.Location = new System.Drawing.Point(104, 188);
		this.pbStatusMod.Margin = new System.Windows.Forms.Padding(4);
		this.pbStatusMod.Name = "pbStatusMod";
		this.pbStatusMod.Size = new System.Drawing.Size(31, 29);
		this.pbStatusMod.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
		this.pbStatusMod.TabIndex = 9;
		this.pbStatusMod.TabStop = false;
		this.label13.Location = new System.Drawing.Point(15, 200);
		this.label13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label13.Name = "label13";
		this.label13.Size = new System.Drawing.Size(80, 19);
		this.label13.TabIndex = 8;
		this.label13.Text = "Mod:";
		this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.pbStatusDCNeg.Image = ICP_MS.Plugin.Advance.Properties.Resources.led_Gray;
		this.pbStatusDCNeg.Location = new System.Drawing.Point(104, 95);
		this.pbStatusDCNeg.Margin = new System.Windows.Forms.Padding(4);
		this.pbStatusDCNeg.Name = "pbStatusDCNeg";
		this.pbStatusDCNeg.Size = new System.Drawing.Size(31, 29);
		this.pbStatusDCNeg.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
		this.pbStatusDCNeg.TabIndex = 7;
		this.pbStatusDCNeg.TabStop = false;
		this.label12.Location = new System.Drawing.Point(15, 101);
		this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label12.Name = "label12";
		this.label12.Size = new System.Drawing.Size(80, 19);
		this.label12.TabIndex = 6;
		this.label12.Text = "-DC:";
		this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.pbStatusDcPlus.Image = ICP_MS.Plugin.Advance.Properties.Resources.led_Gray;
		this.pbStatusDcPlus.Location = new System.Drawing.Point(104, 49);
		this.pbStatusDcPlus.Margin = new System.Windows.Forms.Padding(4);
		this.pbStatusDcPlus.Name = "pbStatusDcPlus";
		this.pbStatusDcPlus.Size = new System.Drawing.Size(31, 29);
		this.pbStatusDcPlus.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
		this.pbStatusDcPlus.TabIndex = 1;
		this.pbStatusDcPlus.TabStop = false;
		this.label9.Location = new System.Drawing.Point(15, 55);
		this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label9.Name = "label9";
		this.label9.Size = new System.Drawing.Size(80, 19);
		this.label9.TabIndex = 0;
		this.label9.Text = "+DC:";
		this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
		this.tabControl1.Controls.Add(this.pageQuad);
		this.tabControl1.Controls.Add(this.pageQuadMonitor);
		this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
		this.tabControl1.Location = new System.Drawing.Point(0, 0);
		this.tabControl1.Name = "tabControl1";
		this.tabControl1.SelectedIndex = 0;
		this.tabControl1.Size = new System.Drawing.Size(1870, 789);
		this.tabControl1.TabIndex = 8;
		this.pageQuad.AutoScroll = true;
		this.pageQuad.Controls.Add(this.groupBox1);
		this.pageQuad.Controls.Add(this.gbQuadScanP);
		this.pageQuad.Controls.Add(this.gQuadParamemter);
		this.pageQuad.Controls.Add(this.gbQuadStatus);
		this.pageQuad.Controls.Add(this.gbQuadMonitor);
		this.pageQuad.Location = new System.Drawing.Point(4, 25);
		this.pageQuad.Name = "pageQuad";
		this.pageQuad.Padding = new System.Windows.Forms.Padding(3);
		this.pageQuad.Size = new System.Drawing.Size(1862, 760);
		this.pageQuad.TabIndex = 0;
		this.pageQuad.Text = "四极杆信息";
		this.pageQuad.UseVisualStyleBackColor = true;
		this.groupBox1.Controls.Add(this.button4);
		this.groupBox1.Controls.Add(this.zedGraphControl1);
		this.groupBox1.Controls.Add(this.btnStop);
		this.groupBox1.Controls.Add(this.btnTuneSecond);
		this.groupBox1.Controls.Add(this.btnTuneFirst);
		this.groupBox1.Controls.Add(this.listInfo);
		this.groupBox1.Location = new System.Drawing.Point(537, 17);
		this.groupBox1.Name = "groupBox1";
		this.groupBox1.Size = new System.Drawing.Size(1013, 535);
		this.groupBox1.TabIndex = 8;
		this.groupBox1.TabStop = false;
		this.groupBox1.Text = "自动调谐";
		this.button4.Location = new System.Drawing.Point(17, 471);
		this.button4.Name = "button4";
		this.button4.Size = new System.Drawing.Size(114, 38);
		this.button4.TabIndex = 69;
		this.button4.Text = "初调";
		this.button4.UseVisualStyleBackColor = true;
		this.button4.Click += new System.EventHandler(button4_Click);
		this.zedGraphControl1.Location = new System.Drawing.Point(336, 21);
		this.zedGraphControl1.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
		this.zedGraphControl1.Name = "zedGraphControl1";
		this.zedGraphControl1.ScrollGrace = 0.0;
		this.zedGraphControl1.ScrollMaxX = 0.0;
		this.zedGraphControl1.ScrollMaxY = 0.0;
		this.zedGraphControl1.ScrollMaxY2 = 0.0;
		this.zedGraphControl1.ScrollMinX = 0.0;
		this.zedGraphControl1.ScrollMinY = 0.0;
		this.zedGraphControl1.ScrollMinY2 = 0.0;
		this.zedGraphControl1.Size = new System.Drawing.Size(654, 427);
		this.zedGraphControl1.TabIndex = 68;
		this.btnStop.Location = new System.Drawing.Point(336, 470);
		this.btnStop.Name = "btnStop";
		this.btnStop.Size = new System.Drawing.Size(115, 39);
		this.btnStop.TabIndex = 2;
		this.btnStop.Text = "停止";
		this.btnStop.UseVisualStyleBackColor = true;
		this.btnStop.Click += new System.EventHandler(btnStop_Click);
		this.btnTuneSecond.Location = new System.Drawing.Point(164, 471);
		this.btnTuneSecond.Name = "btnTuneSecond";
		this.btnTuneSecond.Size = new System.Drawing.Size(115, 39);
		this.btnTuneSecond.TabIndex = 1;
		this.btnTuneSecond.Text = "细调";
		this.btnTuneSecond.UseVisualStyleBackColor = true;
		this.btnTuneSecond.Click += new System.EventHandler(btnTuneSecond_Click);
		this.btnTuneFirst.Location = new System.Drawing.Point(758, 473);
		this.btnTuneFirst.Name = "btnTuneFirst";
		this.btnTuneFirst.Size = new System.Drawing.Size(115, 39);
		this.btnTuneFirst.TabIndex = 1;
		this.btnTuneFirst.Text = "初调";
		this.btnTuneFirst.UseVisualStyleBackColor = true;
		this.btnTuneFirst.Visible = false;
		this.btnTuneFirst.Click += new System.EventHandler(btnTuneFirst_Click);
		this.listInfo.FormattingEnabled = true;
		this.listInfo.ItemHeight = 15;
		this.listInfo.Items.AddRange(new object[1] { "自动调谐进度：" });
		this.listInfo.Location = new System.Drawing.Point(17, 24);
		this.listInfo.Name = "listInfo";
		this.listInfo.Size = new System.Drawing.Size(311, 424);
		this.listInfo.TabIndex = 0;
		this.pageQuadMonitor.Controls.Add(this.gbCurve);
		this.pageQuadMonitor.Location = new System.Drawing.Point(4, 25);
		this.pageQuadMonitor.Name = "pageQuadMonitor";
		this.pageQuadMonitor.Padding = new System.Windows.Forms.Padding(3);
		this.pageQuadMonitor.Size = new System.Drawing.Size(1862, 760);
		this.pageQuadMonitor.TabIndex = 1;
		this.pageQuadMonitor.Text = "温度/功率";
		this.pageQuadMonitor.UseVisualStyleBackColor = true;
		base.AutoScaleDimensions = new System.Drawing.SizeF(8f, 15f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(1870, 789);
		base.Controls.Add(this.tabControl1);
		base.Margin = new System.Windows.Forms.Padding(4);
		base.Name = "FormQuad";
		base.ShowIcon = false;
		this.Text = "FormQuad";
		base.FormClosing += new System.Windows.Forms.FormClosingEventHandler(FormQuad_FormClosing);
		base.Load += new System.EventHandler(FormQuad_Load);
		this.gQuadParamemter.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.nudTune).EndInit();
		((System.ComponentModel.ISupportInitialize)this.numericUpDown1).EndInit();
		((System.ComponentModel.ISupportInitialize)this.nudTemperature).EndInit();
		((System.ComponentModel.ISupportInitialize)this.nudFreq).EndInit();
		((System.ComponentModel.ISupportInitialize)this.nudDCB0).EndInit();
		((System.ComponentModel.ISupportInitialize)this.nudDCK0).EndInit();
		((System.ComponentModel.ISupportInitialize)this.nudACB0).EndInit();
		((System.ComponentModel.ISupportInitialize)this.nudACK0).EndInit();
		this.gbQuadScanP.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.nudHexB0).EndInit();
		((System.ComponentModel.ISupportInitialize)this.nudHexK0).EndInit();
		this.gbQuadMonitor.ResumeLayout(false);
		this.gbQuadMonitor.PerformLayout();
		this.gbCurve.ResumeLayout(false);
		this.gbCurve.PerformLayout();
		this.tableLayoutPanel1.ResumeLayout(false);
		this.gbQuadStatus.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.pbStatusErI).EndInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatusTune).EndInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatusRelay).EndInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatus48V).EndInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatusBias).EndInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatusRF).EndInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatusMod).EndInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatusDCNeg).EndInit();
		((System.ComponentModel.ISupportInitialize)this.pbStatusDcPlus).EndInit();
		this.tabControl1.ResumeLayout(false);
		this.pageQuad.ResumeLayout(false);
		this.groupBox1.ResumeLayout(false);
		this.pageQuadMonitor.ResumeLayout(false);
		base.ResumeLayout(false);
	}
}
